summaryrefslogtreecommitdiffstats
path: root/vendor/github.com/labstack/echo/middleware/basic_auth.go
diff options
context:
space:
mode:
authorWim <wim@42.be>2017-12-07 23:00:56 +0100
committerWim <wim@42.be>2017-12-07 23:00:56 +0100
commit5c919e6bffbf5dbe057623323effdbed2e82189e (patch)
tree8e0130ea7387ac1a38c8ceb5b85de1f43435bbe0 /vendor/github.com/labstack/echo/middleware/basic_auth.go
parent434393d1c3ade598bd38c98eefe7db93be4c9b27 (diff)
downloadmatterbridge-msglm-5c919e6bffbf5dbe057623323effdbed2e82189e.tar.gz
matterbridge-msglm-5c919e6bffbf5dbe057623323effdbed2e82189e.tar.bz2
matterbridge-msglm-5c919e6bffbf5dbe057623323effdbed2e82189e.zip
Update vendor labstack/echo
Diffstat (limited to 'vendor/github.com/labstack/echo/middleware/basic_auth.go')
-rw-r--r--vendor/github.com/labstack/echo/middleware/basic_auth.go7
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