verifyIssuer compares the iss claim in claims against cmp. If iss is not set, it will succeed if the claim is not required, otherwise ErrTokenRequiredClaimMissing will be returned. Additionally, if any error occurs while retrieving the claim, e.g., when its the wrong type, an ErrTokenUnverifiable
(claims Claims, cmp string, required bool)
| 277 | // Additionally, if any error occurs while retrieving the claim, e.g., when its |
| 278 | // the wrong type, an ErrTokenUnverifiable error will be returned. |
| 279 | func (v *Validator) verifyIssuer(claims Claims, cmp string, required bool) error { |
| 280 | iss, err := claims.GetIssuer() |
| 281 | if err != nil { |
| 282 | return err |
| 283 | } |
| 284 | |
| 285 | if iss == "" { |
| 286 | return errorIfRequired(required, "iss") |
| 287 | } |
| 288 | |
| 289 | return errorIfFalse(iss == cmp, ErrTokenInvalidIssuer) |
| 290 | } |
| 291 | |
| 292 | // verifySubject compares the sub claim against cmp. |
| 293 | // |