Skip to content

Commit

Permalink
ErrorHandler JWT
Browse files Browse the repository at this point in the history
  • Loading branch information
GNURub committed Apr 14, 2020
1 parent 8c2757f commit edea272
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions protocol/api/api.go
Original file line number Diff line number Diff line change
Expand Up @@ -86,6 +86,14 @@ func JWTMiddleware(next http.Handler) http.Handler {
return []byte(configure.Config.GetString("jwt.secret")), nil
},
SigningMethod: algorithm,
ErrorHandler: func(w http.ResponseWriter, r *http.Request, err string) {
res := &Response{
w: w,
Status: 403,
Data: err,
}
res.SendJson()
},
})

jwtMiddleware.HandlerWithNext(w, r, next.ServeHTTP)
Expand Down

0 comments on commit edea272

Please sign in to comment.