verifyNotBefore compares the nbf claim in claims against cmp. This function will return true if cmp >= nbf. Additional leeway is taken into account. If nbf is not set, it will succeed if the claim is not required, otherwise ErrTokenRequiredClaimMissing will be returned. Additionally, if any error
(claims Claims, cmp time.Time, required bool)
| 215 | // Additionally, if any error occurs while retrieving the claim, e.g., when its |
| 216 | // the wrong type, an ErrTokenUnverifiable error will be returned. |
| 217 | func (v *Validator) verifyNotBefore(claims Claims, cmp time.Time, required bool) error { |
| 218 | nbf, err := claims.GetNotBefore() |
| 219 | if err != nil { |
| 220 | return err |
| 221 | } |
| 222 | |
| 223 | if nbf == nil { |
| 224 | return errorIfRequired(required, "nbf") |
| 225 | } |
| 226 | |
| 227 | return errorIfFalse(!cmp.Before(nbf.Add(-v.leeway)), ErrTokenNotValidYet) |
| 228 | } |
| 229 | |
| 230 | // verifyAudience compares the aud claim against cmp. |
| 231 | // |