feat(authn-oidc): use full urls for login callback/logout options
This commit is contained in:
38
internal/proxy/director/layer/authn/oidc/options.go
Normal file
38
internal/proxy/director/layer/authn/oidc/options.go
Normal file
@ -0,0 +1,38 @@
|
||||
package oidc
|
||||
|
||||
import (
|
||||
"net/http"
|
||||
"time"
|
||||
)
|
||||
|
||||
type Options struct {
|
||||
HTTPTransport *http.Transport
|
||||
HTTPClientTimeout time.Duration
|
||||
}
|
||||
|
||||
type OptionFunc func(opts *Options)
|
||||
|
||||
func WithHTTPTransport(transport *http.Transport) OptionFunc {
|
||||
return func(opts *Options) {
|
||||
opts.HTTPTransport = transport
|
||||
}
|
||||
}
|
||||
|
||||
func WithHTTPClientTimeout(timeout time.Duration) OptionFunc {
|
||||
return func(opts *Options) {
|
||||
opts.HTTPClientTimeout = timeout
|
||||
}
|
||||
}
|
||||
|
||||
func NewOptions(funcs ...OptionFunc) *Options {
|
||||
opts := &Options{
|
||||
HTTPTransport: http.DefaultTransport.(*http.Transport),
|
||||
HTTPClientTimeout: 30 * time.Second,
|
||||
}
|
||||
|
||||
for _, fn := range funcs {
|
||||
fn(opts)
|
||||
}
|
||||
|
||||
return opts
|
||||
}
|
Reference in New Issue
Block a user