MCPcopy
hub / github.com/golang-jwt/jwt / verifyIssuedAt

Method verifyIssuedAt

validator.go:196–207  ·  view source on GitHub ↗

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)

Source from the content-addressed store, hash-verified

194// Additionally, if any error occurs while retrieving the claim, e.g., when its
195// the wrong type, an ErrTokenUnverifiable error will be returned.
196func (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.

Callers 2

ValidateMethod · 0.95

Calls 3

errorIfRequiredFunction · 0.85
errorIfFalseFunction · 0.85
GetIssuedAtMethod · 0.65

Tested by 1