verifyExpiresAt compares the exp claim in claims against cmp. This function will succeed if cmp < exp. Additional leeway is taken into account. If exp 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)
| 173 | // Additionally, if any error occurs while retrieving the claim, e.g., when its |
| 174 | // the wrong type, an ErrTokenUnverifiable error will be returned. |
| 175 | func (v *Validator) verifyExpiresAt(claims Claims, cmp time.Time, required bool) error { |
| 176 | exp, err := claims.GetExpirationTime() |
| 177 | if err != nil { |
| 178 | return err |
| 179 | } |
| 180 | |
| 181 | if exp == nil { |
| 182 | return errorIfRequired(required, "exp") |
| 183 | } |
| 184 | |
| 185 | return errorIfFalse(cmp.Before((exp.Time).Add(+v.leeway)), ErrTokenExpired) |
| 186 | } |
| 187 | |
| 188 | // verifyIssuedAt compares the iat claim in claims against cmp. This function |
| 189 | // will succeed if cmp >= iat. Additional leeway is taken into account. |