mirror of
https://github.com/labstack/echo.git
synced 2025-07-05 00:58:47 +02:00
Fixed basic-auth middleware
Signed-off-by: Vishal Rana <vr@labstack.com>
This commit is contained in:
@ -13,6 +13,7 @@ type (
|
||||
Skipper Skipper
|
||||
|
||||
// Validator is a function to validate BasicAuth credentials.
|
||||
// Required.
|
||||
Validator BasicAuthValidator
|
||||
}
|
||||
|
||||
@ -46,6 +47,9 @@ func BasicAuth(fn BasicAuthValidator) echo.MiddlewareFunc {
|
||||
// See `BasicAuth()`.
|
||||
func BasicAuthWithConfig(config BasicAuthConfig) echo.MiddlewareFunc {
|
||||
// Defaults
|
||||
if config.Validator == nil {
|
||||
panic("basic-auth middleware requires validator function")
|
||||
}
|
||||
if config.Skipper == nil {
|
||||
config.Skipper = DefaultBasicAuthConfig.Skipper
|
||||
}
|
||||
|
Reference in New Issue
Block a user