1
0
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:
Vishal Rana 2016-09-05 10:20:10 -07:00
parent 025c53d4cf
commit 4850d69c30
2 changed files with 5 additions and 1 deletions

View File

@ -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
}

View File

@ -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())`