Documentation ¶
Overview ¶
Package forward provides a middleware that forward the auth to the external server.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func ForwardAuth ¶
func ForwardAuth(config Config) (middleware.Middleware, error)
ForwardAuth returns a new middleware named "forwardauth", which forwards the authentication to the external server.
Types ¶
type Config ¶
type Config struct { // Required URL string `json:"url,omitempty" yaml:"url,omitempty"` // Optional, if exists, use the upstream as the transport. Upstream string `json:"upstream,omitempty" yaml:"upstream,omitempty"` // Optional Method string `json:"method,omitempty" yaml:"method,omitempty"` // Default: GET, one of GET or POST Headers []string `json:"headers,omitempty" yaml:"headers,omitempty"` // Default: nil // Timeout to get the auth result from the authorization server. // // Default: 3s Timeout time.Duration `json:"timeout,omitempty" yaml:"timeout,omitempty"` // These is the response headers returned by the authorization server. // UpstreamHeaders are forwarded to the upstream backend server if auth succeeded. // ClientHeaders are forwarded to the client if auth failed. // // Support that the last character is "*" as the prefix matching, // Such as "X-User-*". // // Default: nil UpstreamHeaders []string `json:"upstreamHeaders,omitempty" yaml:"upstreamHeaders,omitempty"` ClientHeaders []string `json:"clientHeaders,omitempty" yaml:"clientHeaders,omitempty"` // If true and auth failure, still forward the request to upstream backend server. // // Default: false Degraded bool `json:"degraded,omitempty" yaml:"degraded,omitempty"` // Default: http.DefaultClient Client *http.Client `json:"-" yaml:"-"` }
Config is the configuration information to forward the authorization request to the authorization server.
Click to show internal directories.
Click to hide internal directories.