mirror of
https://github.com/labstack/echo.git
synced 2024-11-24 08:22:21 +02:00
Fixed basic-auth middleware
Signed-off-by: Vishal Rana <vr@labstack.com>
This commit is contained in:
parent
025c53d4cf
commit
4850d69c30
@ -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
|
||||
}
|
||||
|
@ -135,7 +135,7 @@ func WWWRedirectWithConfig(config RedirectConfig) echo.MiddlewareFunc {
|
||||
}
|
||||
}
|
||||
|
||||
// NonWWWRedirect redirects WWW request to non WWW.
|
||||
// NonWWWRedirect redirects WWW requests to non WWW.
|
||||
// For example, http://www.labstack.com will be redirect to http://labstack.com.
|
||||
//
|
||||
// Usage `Echo#Pre(NonWWWRedirect())`
|
||||
|
Loading…
Reference in New Issue
Block a user