adhere to jwt/v4 security recommendation: "validate the alg presented is what you expect"
parent
07fe90ff5f
commit
6e6beab914
|
@ -87,7 +87,8 @@ func withUser(fn handleFunc) handleFunc {
|
||||||
}
|
}
|
||||||
|
|
||||||
var tk authToken
|
var tk authToken
|
||||||
token, err := request.ParseFromRequest(r, &extractor{}, keyFunc, request.WithClaims(&tk))
|
p := jwt.NewParser(jwt.WithValidMethods([]string{jwt.SigningMethodHS256.Alg()}))
|
||||||
|
token, err := request.ParseFromRequest(r, &extractor{}, keyFunc, request.WithClaims(&tk), request.WithParser(p))
|
||||||
|
|
||||||
if (err != nil || !token.Valid) && !renewableErr(err, d) {
|
if (err != nil || !token.Valid) && !renewableErr(err, d) {
|
||||||
return http.StatusUnauthorized, nil
|
return http.StatusUnauthorized, nil
|
||||||
|
|
Loading…
Reference in New Issue