Skip to content

Security

jwtlib.models.security

JWT token payload models.


Summary

This module defines typed representations of decoded JWT payloads used internally for token validation and user resolution.

Classes

TokenPayload

Bases: BaseModel

Decoded JWT payload.

Attributes:

Name Type Description
sub str

Subject claim identifying the user (typically a username or user ID).

exp int

Expiration time as a Unix timestamp (seconds since epoch).

Notes

Responsibilities:

1
- Represents the validated claims extracted from a JWT after signature verification. This model is used internally to enforce required claims and provide a typed interface to token data.

Guarantees:

1
- This model assumes the JWT signature has already been verified. No authorization decisions should be made solely on this model. Additional claims may exist but are intentionally ignored.