diff options
Diffstat (limited to 'vendor/github.com/labstack/echo/middleware/basic_auth.go')
-rw-r--r-- | vendor/github.com/labstack/echo/middleware/basic_auth.go | 7 |
1 files changed, 4 insertions, 3 deletions
diff --git a/vendor/github.com/labstack/echo/middleware/basic_auth.go b/vendor/github.com/labstack/echo/middleware/basic_auth.go index c1f34c8f..ae80da95 100644 --- a/vendor/github.com/labstack/echo/middleware/basic_auth.go +++ b/vendor/github.com/labstack/echo/middleware/basic_auth.go @@ -3,6 +3,7 @@ package middleware import ( "encoding/base64" "strconv" + "strings" "github.com/labstack/echo" ) @@ -27,7 +28,7 @@ type ( ) const ( - basic = "Basic" + basic = "basic" defaultRealm = "Restricted" ) @@ -54,7 +55,7 @@ func BasicAuth(fn BasicAuthValidator) echo.MiddlewareFunc { func BasicAuthWithConfig(config BasicAuthConfig) echo.MiddlewareFunc { // Defaults if config.Validator == nil { - panic("basic-auth middleware requires a validator function") + panic("echo: basic-auth middleware requires a validator function") } if config.Skipper == nil { config.Skipper = DefaultBasicAuthConfig.Skipper @@ -72,7 +73,7 @@ func BasicAuthWithConfig(config BasicAuthConfig) echo.MiddlewareFunc { auth := c.Request().Header.Get(echo.HeaderAuthorization) l := len(basic) - if len(auth) > l+1 && auth[:l] == basic { + if len(auth) > l+1 && strings.ToLower(auth[:l]) == basic { b, err := base64.StdEncoding.DecodeString(auth[l+1:]) if err != nil { return err |