summaryrefslogtreecommitdiffstats
path: root/vendor/github.com/labstack/echo/middleware/csrf.go
diff options
context:
space:
mode:
authorDuco van Amstel <helcaraxan@gmail.com>2018-11-18 17:55:05 +0000
committerWim <wim@42.be>2018-11-25 21:21:04 +0100
commit09875fe1603307080f3a4172985c5dca3bd9912d (patch)
treea23220772f6f6597d509ca71b2df3480a77b8076 /vendor/github.com/labstack/echo/middleware/csrf.go
parentf716b8fc0ff90f47b61e218ef34019b38bd70e0d (diff)
downloadmatterbridge-msglm-09875fe1603307080f3a4172985c5dca3bd9912d.tar.gz
matterbridge-msglm-09875fe1603307080f3a4172985c5dca3bd9912d.tar.bz2
matterbridge-msglm-09875fe1603307080f3a4172985c5dca3bd9912d.zip
Update direct dependencies where possible
Diffstat (limited to 'vendor/github.com/labstack/echo/middleware/csrf.go')
-rw-r--r--vendor/github.com/labstack/echo/middleware/csrf.go8
1 files changed, 4 insertions, 4 deletions
diff --git a/vendor/github.com/labstack/echo/middleware/csrf.go b/vendor/github.com/labstack/echo/middleware/csrf.go
index 0d2b7fd6..5d1f4671 100644
--- a/vendor/github.com/labstack/echo/middleware/csrf.go
+++ b/vendor/github.com/labstack/echo/middleware/csrf.go
@@ -126,8 +126,8 @@ func CSRFWithConfig(config CSRFConfig) echo.MiddlewareFunc {
k, err := c.Cookie(config.CookieName)
token := ""
+ // Generate token
if err != nil {
- // Generate token
token = random.String(config.TokenLength)
} else {
// Reuse token
@@ -143,7 +143,7 @@ func CSRFWithConfig(config CSRFConfig) echo.MiddlewareFunc {
return echo.NewHTTPError(http.StatusBadRequest, err.Error())
}
if !validateCSRFToken(token, clientToken) {
- return echo.NewHTTPError(http.StatusForbidden, "Invalid csrf token")
+ return echo.NewHTTPError(http.StatusForbidden, "invalid csrf token")
}
}
@@ -187,7 +187,7 @@ func csrfTokenFromForm(param string) csrfTokenExtractor {
return func(c echo.Context) (string, error) {
token := c.FormValue(param)
if token == "" {
- return "", errors.New("Missing csrf token in the form parameter")
+ return "", errors.New("missing csrf token in the form parameter")
}
return token, nil
}
@@ -199,7 +199,7 @@ func csrfTokenFromQuery(param string) csrfTokenExtractor {
return func(c echo.Context) (string, error) {
token := c.QueryParam(param)
if token == "" {
- return "", errors.New("Missing csrf token in the query string")
+ return "", errors.New("missing csrf token in the query string")
}
return token, nil
}