Extract inner error when parsing JWT
This commit is contained in:
parent
0751c0cf7e
commit
5986d2bb9b
@ -114,6 +114,10 @@ func assertServerToken(key *rsa.PublicKey, serverToken string) (*peering.ServerT
|
||||
}
|
||||
token, err := jwt.ParseWithClaims(serverToken, &peering.ServerTokenClaims{}, fn)
|
||||
if err != nil {
|
||||
validationError, ok := err.(*jwt.ValidationError)
|
||||
if ok {
|
||||
return nil, validationError.Inner
|
||||
}
|
||||
return nil, err
|
||||
}
|
||||
if !token.Valid {
|
||||
@ -146,6 +150,10 @@ func assertClientToken(peerID peering.PeerID, store peering.Store, clientToken s
|
||||
}
|
||||
token, err := jwt.ParseWithClaims(clientToken, &peering.ClientTokenClaims{}, fn)
|
||||
if err != nil {
|
||||
validationError, ok := err.(*jwt.ValidationError)
|
||||
if ok {
|
||||
return nil, validationError.Inner
|
||||
}
|
||||
return nil, err
|
||||
}
|
||||
if !token.Valid {
|
||||
|
Loading…
Reference in New Issue
Block a user