1
0
mirror of https://github.com/labstack/echo.git synced 2025-03-27 21:48:57 +02:00

Merge pull request #1627 from juanbelieni/master

Create ErrJWTInvalid to allow modify error when JWT is invalid
This commit is contained in:
Roland Lammel 2020-09-01 16:10:16 +02:00 committed by GitHub
commit 28ec3f7bdb
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -86,6 +86,7 @@ const (
// Errors
var (
ErrJWTMissing = echo.NewHTTPError(http.StatusBadRequest, "missing or malformed jwt")
ErrJWTInvalid = echo.NewHTTPError(http.StatusUnauthorized, "invalid or expired jwt")
)
var (
@ -213,8 +214,8 @@ func JWTWithConfig(config JWTConfig) echo.MiddlewareFunc {
return config.ErrorHandlerWithContext(err, c)
}
return &echo.HTTPError{
Code: http.StatusUnauthorized,
Message: "invalid or expired jwt",
Code: ErrJWTInvalid.Code,
Message: ErrJWTInvalid.Message,
Internal: err,
}
}