verifyIssuedAt compares the iat claim in claims against cmp. This function will succeed if cmp >= iat. Additional leeway is taken into account. If iat is not set, it will succeed if the claim is not required, otherwise ErrTokenRequiredClaimMissing will be returned. Additionally, if any error occur
(claims Claims, cmp time.Time, required bool)
| 194 | // Additionally, if any error occurs while retrieving the claim, e.g., when its |
| 195 | // the wrong type, an ErrTokenUnverifiable error will be returned. |
| 196 | func (v *Validator) verifyIssuedAt(claims Claims, cmp time.Time, required bool) error { |
| 197 | iat, err := claims.GetIssuedAt() |
| 198 | if err != nil { |
| 199 | return err |
| 200 | } |
| 201 | |
| 202 | if iat == nil { |
| 203 | return errorIfRequired(required, "iat") |
| 204 | } |
| 205 | |
| 206 | return errorIfFalse(!cmp.Before(iat.Add(-v.leeway)), ErrTokenUsedBeforeIssued) |
| 207 | } |
| 208 | |
| 209 | // verifyNotBefore compares the nbf claim in claims against cmp. This function |
| 210 | // will return true if cmp >= nbf. Additional leeway is taken into account. |