Re-populate public key if JWT fails to parse (#6786)

This is done such that if WSO2 was re-configured
with new TLS certs, and newer tokens are signed
with a newer public key. Once populated parse the JWT
again
master
Harshavardhana 6 years ago committed by kannappanr
parent 38978eb2aa
commit a40610d331
  1. 8
      pkg/iam/validator/jwt.go

@ -185,7 +185,13 @@ func (p *JWT) Validate(token, dsecs string) (map[string]interface{}, error) {
var claims jwtgo.MapClaims
jwtToken, err := jwtgo.ParseWithClaims(token, &claims, keyFuncCallback)
if err != nil {
return nil, err
if err = p.args.PopulatePublicKey(); err != nil {
return nil, err
}
jwtToken, err = jwtgo.ParseWithClaims(token, &claims, keyFuncCallback)
if err != nil {
return nil, err
}
}
if !jwtToken.Valid {

Loading…
Cancel
Save