Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func BasicAuthFieldSpec ¶
BasicAuthFieldSpec returns the spec for an HTTP BasicAuth component.
func ServerCORSFieldSpec ¶
ServerCORSFieldSpec returns a field spec for an http server CORS component.
Types ¶
type BasicAuthConfig ¶
type BasicAuthConfig struct { Enabled bool `json:"enabled" yaml:"enabled"` Username string `json:"username" yaml:"username"` PasswordHash string `json:"password_hash" yaml:"password_hash"` Realm string `json:"realm" yaml:"realm"` Algorithm string `json:"algorithm" yaml:"algorithm"` Salt string `json:"salt" yaml:"salt"` }
BasicAuthConfig contains struct based fields for basic authentication.
func BasicAuthConfigFromParsed ¶
func BasicAuthConfigFromParsed(pConf *docs.ParsedConfig) (conf BasicAuthConfig, err error)
BasicAuthConfigFromParsed extracts the auth fields from the parsed config and returns a BasicAuth config.
func NewBasicAuthConfig ¶
func NewBasicAuthConfig() BasicAuthConfig
NewBasicAuthConfig returns a BasicAuthConfig with default values.
func (BasicAuthConfig) Validate ¶
func (b BasicAuthConfig) Validate() error
Validate confirms that the BasicAuth is properly configured.
func (BasicAuthConfig) WrapHandler ¶
func (b BasicAuthConfig) WrapHandler(next http.HandlerFunc) http.HandlerFunc
WrapHandler wraps the provided HTTP handler with middleware that enforces BasicAuth if it's enabled.
type CORSConfig ¶
type CORSConfig struct { Enabled bool `json:"enabled" yaml:"enabled"` AllowedOrigins []string `json:"allowed_origins" yaml:"allowed_origins"` }
CORSConfig contains struct configuration for allowing CORS headers.
func CORSConfigFromParsed ¶
func CORSConfigFromParsed(pConf *docs.ParsedConfig) (conf CORSConfig, err error)
CORSConfigFromParsed extracts the CORS fields from the parsed config and returns a CORS config.
func NewServerCORSConfig ¶
func NewServerCORSConfig() CORSConfig
NewServerCORSConfig returns a new server CORS config with default fields.
func (CORSConfig) WrapHandler ¶
WrapHandler wraps a provided HTTP handler with middleware that enables CORS requests (when configured).