MCPcopy Create free account
hub / github.com/mpdavis/python-jose / _validate_jti

Function _validate_jti

jose/jwt.py:418–437  ·  view source on GitHub ↗

Validates that the 'jti' claim is valid. The "jti" (JWT ID) claim provides a unique identifier for the JWT. The identifier value MUST be assigned in a manner that ensures that there is a negligible probability that the same value will be accidentally assigned to a different data obj

(claims)

Source from the content-addressed store, hash-verified

416
417
418def _validate_jti(claims):
419 """Validates that the 'jti' claim is valid.
420
421 The "jti" (JWT ID) claim provides a unique identifier for the JWT.
422 The identifier value MUST be assigned in a manner that ensures that
423 there is a negligible probability that the same value will be
424 accidentally assigned to a different data object; if the application
425 uses multiple issuers, collisions MUST be prevented among values
426 produced by different issuers as well. The "jti" claim can be used
427 to prevent the JWT from being replayed. The "jti" value is a case-
428 sensitive string. Use of this claim is OPTIONAL.
429
430 Args:
431 claims (dict): The claims dictionary to validate.
432 """
433 if "jti" not in claims:
434 return
435
436 if not isinstance(claims["jti"], str):
437 raise JWTClaimsError("JWT ID must be a string.")
438
439
440def _validate_at_hash(claims, access_token, algorithm):

Callers 1

_validate_claimsFunction · 0.85

Calls 1

JWTClaimsErrorClass · 0.85

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…