Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
View Source
var ( // DefaultKeyAuthConfig is the default PathAuth middleware config. DefaultKeyAuthConfig = PathAuthConfig{ Skipper: middleware.DefaultSkipper, } )
View Source
var ErrKeyAuthMissing = echo.NewHTTPError(http.StatusBadRequest, "Missing key in the request")
ErrKeyAuthMissing is error type when PathAuth middleware is unable to extract value from lookups
Functions ¶
func PathAuth ¶
func PathAuth(param string, fn PathAuthValidator) echo.MiddlewareFunc
PathAuth returns an PathAuth 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 PathAuthWithConfig ¶
func PathAuthWithConfig(config PathAuthConfig) echo.MiddlewareFunc
Types ¶
type PathAuthConfig ¶
type PathAuthConfig struct { // Skipper defines a function to skip middleware. Skipper middleware.Skipper // Validator is a function to validate key. // Required. Validator PathAuthValidator Param string }
PathAuthConfig defines the config for PathAuth middleware.
type PathAuthValidator ¶
PathAuthValidator defines a function to validate PathAuth credentials.
Click to show internal directories.
Click to hide internal directories.