Browse Source

ErrorHandler JWT

pull/88/head
Ruben Cid 5 years ago
parent
commit
edea272403
  1. 8
      protocol/api/api.go

8
protocol/api/api.go

@ -86,6 +86,14 @@ func JWTMiddleware(next http.Handler) http.Handler { @@ -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)

Loading…
Cancel
Save