Documentation
¶
Index ¶
- Variables
- func AuthApiKey(cfg domain.SpringCloudConfig) echo.MiddlewareFunc
- func AuthBasic(cfg domain.SpringCloudConfig) echo.MiddlewareFunc
- func KeyAuth(fn KeyAuthValidator) echo.MiddlewareFunc
- func KeyAuthWithConfig(config KeyAuthConfig) echo.MiddlewareFunc
- type KeyAuthConfig
- type KeyAuthValidator
Constants ¶
This section is empty.
Variables ¶
View Source
var ( // DefaultKeyAuthConfig is the default KeyAuth middleware config. DefaultKeyAuthConfig = KeyAuthConfig{ Skipper: middleware.DefaultSkipper, KeyLookup: "header:" + echo.HeaderAuthorization, AuthScheme: "Bearer", } )
Functions ¶
func AuthApiKey ¶
func AuthApiKey(cfg domain.SpringCloudConfig) echo.MiddlewareFunc
func AuthBasic ¶
func AuthBasic(cfg domain.SpringCloudConfig) echo.MiddlewareFunc
func KeyAuth ¶
func KeyAuth(fn KeyAuthValidator) echo.MiddlewareFunc
KeyAuth returns an KeyAuth middleware.
For valid key it calls the next handler. For invalid key, it sends "401 - Unauthorized" response. For missing key, it sends "400 - Bad Request" response.
func KeyAuthWithConfig ¶
func KeyAuthWithConfig(config KeyAuthConfig) echo.MiddlewareFunc
KeyAuthWithConfig returns an KeyAuth middleware with config. See `KeyAuth()`.
Types ¶
type KeyAuthConfig ¶
type KeyAuthConfig struct { // Skipper defines a function to skip middleware. Skipper middleware.Skipper // KeyLookup is a string in the form of "<source>:<name>" that is used // to extract key from the request. // Optional. Default value "header:Authorization". // Possible values: // - "header:<name>" // - "query:<name>" // - "form:<name>" KeyLookup string `yaml:"key_lookup"` // AuthScheme to be used in the Authorization header. // Optional. Default value "Bearer". AuthScheme string // Validator is a function to validate key. // Required. Validator KeyAuthValidator }
KeyAuthConfig defines the config for KeyAuth middleware.
type KeyAuthValidator ¶
KeyAuthValidator defines a function to validate KeyAuth credentials.
Click to show internal directories.
Click to hide internal directories.