Skip to content

Commit

Permalink
feat(ci/cd):add (ci/cd)
Browse files Browse the repository at this point in the history
  • Loading branch information
OOrangeeee committed Oct 14, 2024
1 parent 4ddff7a commit 1454e73
Showing 1 changed file with 9 additions and 0 deletions.
9 changes: 9 additions & 0 deletions internal/configs/middlewareConfig.go
Original file line number Diff line number Diff line change
Expand Up @@ -84,6 +84,15 @@ func InitMiddleware(e *echo.Echo, jwtSecret string) {
},
SigningKey: jwtSecret,
TokenLookup: "header:Authorization:Bearer ",
ErrorHandler: func(c echo.Context, err error) error {
utils.Log.WithFields(logrus.Fields{
"error": err.Error(),
"jwtS": jwtSecret,
"jwt": c.Request().Header.Get("Authorization"),
}).Error("JWT validation failed")
return echo.NewHTTPError(http.StatusUnauthorized, "Invalid or expired JWT")
},

SuccessHandler: func(c echo.Context) {
user := c.Get("user").(*jwt.Token)
claims, ok := user.Claims.(jwt.MapClaims)
Expand Down

0 comments on commit 1454e73

Please sign in to comment.