Skip to content

Commit

Permalink
Merge pull request #1627 from juanbelieni/master
Browse files Browse the repository at this point in the history
Create ErrJWTInvalid to allow modify error when JWT is invalid
  • Loading branch information
lammel authored Sep 1, 2020
2 parents 2d79ff3 + 09f36b5 commit 28ec3f7
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions middleware/jwt.go
Original file line number Diff line number Diff line change
Expand Up @@ -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 (
Expand Down Expand Up @@ -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,
}
}
Expand Down

0 comments on commit 28ec3f7

Please sign in to comment.