2167 lines
130 KiB
JSON
2167 lines
130 KiB
JSON
{
|
|
"module": "jwtlib",
|
|
"content": {
|
|
"path": "jwtlib",
|
|
"docstring": "# Summary\n\n`jwtlib`: A framework-agnostic `JWT` authentication library.\n\n`jwtlib` provides a set of pure logic components for handling `JWT` discovery,\nuser registration, login, and token introspection. It is designed to be\ndecoupled from any specific web framework (like FastAPI or Flask).\n\n---\n\n# Installation\n\nInstall using pip:\n\n```bash\npip install py-jwt\n```\n\n---\n\n# Quick Start\n\n```python\nimport asyncio\nfrom jwtlib import login_user, LoginRequest\n\nasync def main():\n request = LoginRequest(username=\"admin\", password=\"password\")\n response = await login_user(request)\n print(f\"Access Token: {response.access_token}\")\n```\n\n---\n\n# Public API\n\nThis package re-exports the **core authentication primitives**.\nConsumers are encouraged to import from this namespace for high-level\noperations.\n\n**Authentication:**\n\n- `register_user`\n- `login_user`\n- `logout_user`\n- `get_logged_in_user`\n\n**Introspection:**\n\n- `introspect_token`\n- `authenticate_request` (logic-only)\n\n**Models:**\n\n- `RegisterRequest` / `LoginRequest` / `LoginResponse` / `LogoutResponse`\n- `PublicUser`\n- `IntrospectRequest` / `IntrospectResponse`\n- `TokenPayload`\n\n**Exceptions:**\n\n- `AuthError`\n- `InvalidToken`\n- `UserNotFound`\n\n---",
|
|
"objects": {
|
|
"User": {
|
|
"name": "User",
|
|
"kind": "class",
|
|
"path": "jwtlib.User",
|
|
"signature": "<bound method Alias.signature of Alias('User', 'jwtlib.models.User')>",
|
|
"docstring": "Internal user persistence model.\n\nAttributes:\n hashed_password (str):\n Secure hash of the user's password.\n\nNotes:\n **Responsibilities:**\n\n - Represents a user record as stored in the database. Includes\n sensitive fields and is strictly confined to the persistence\n layer.\n\n **Guarantees:**\n\n - This model MUST NOT be returned from authentication APIs.\n Consumers should use `PublicUser` instead. Password verification\n is handled by the repository layer.",
|
|
"members": {
|
|
"hashed_password": {
|
|
"name": "hashed_password",
|
|
"kind": "attribute",
|
|
"path": "jwtlib.User.hashed_password",
|
|
"signature": "<bound method Alias.signature of Alias('hashed_password', 'jwtlib.models.mongo.User.hashed_password')>",
|
|
"docstring": null
|
|
}
|
|
}
|
|
},
|
|
"RegisterRequest": {
|
|
"name": "RegisterRequest",
|
|
"kind": "class",
|
|
"path": "jwtlib.RegisterRequest",
|
|
"signature": "<bound method Alias.signature of Alias('RegisterRequest', 'jwtlib.models.RegisterRequest')>",
|
|
"docstring": "Payload for registering a new user account.\n\nAttributes:\n username (str):\n Unique username identifier.\n email (EmailStr, optional):\n User's email address.\n password (str):\n Plain-text password (to be hashed by the repository layer).",
|
|
"members": {
|
|
"model_config": {
|
|
"name": "model_config",
|
|
"kind": "attribute",
|
|
"path": "jwtlib.RegisterRequest.model_config",
|
|
"signature": "<bound method Alias.signature of Alias('model_config', 'jwtlib.models.app.RegisterRequest.model_config')>",
|
|
"docstring": null
|
|
},
|
|
"username": {
|
|
"name": "username",
|
|
"kind": "attribute",
|
|
"path": "jwtlib.RegisterRequest.username",
|
|
"signature": "<bound method Alias.signature of Alias('username', 'jwtlib.models.app.RegisterRequest.username')>",
|
|
"docstring": null
|
|
},
|
|
"email": {
|
|
"name": "email",
|
|
"kind": "attribute",
|
|
"path": "jwtlib.RegisterRequest.email",
|
|
"signature": "<bound method Alias.signature of Alias('email', 'jwtlib.models.app.RegisterRequest.email')>",
|
|
"docstring": null
|
|
},
|
|
"password": {
|
|
"name": "password",
|
|
"kind": "attribute",
|
|
"path": "jwtlib.RegisterRequest.password",
|
|
"signature": "<bound method Alias.signature of Alias('password', 'jwtlib.models.app.RegisterRequest.password')>",
|
|
"docstring": null
|
|
}
|
|
}
|
|
},
|
|
"LoginRequest": {
|
|
"name": "LoginRequest",
|
|
"kind": "class",
|
|
"path": "jwtlib.LoginRequest",
|
|
"signature": "<bound method Alias.signature of Alias('LoginRequest', 'jwtlib.models.LoginRequest')>",
|
|
"docstring": "Payload for authenticating a user and issuing a `JWT`.\n\nAttributes:\n username (str):\n Username identifier.\n password (str):\n Plain-text password to be verified.",
|
|
"members": {
|
|
"model_config": {
|
|
"name": "model_config",
|
|
"kind": "attribute",
|
|
"path": "jwtlib.LoginRequest.model_config",
|
|
"signature": "<bound method Alias.signature of Alias('model_config', 'jwtlib.models.app.LoginRequest.model_config')>",
|
|
"docstring": null
|
|
},
|
|
"username": {
|
|
"name": "username",
|
|
"kind": "attribute",
|
|
"path": "jwtlib.LoginRequest.username",
|
|
"signature": "<bound method Alias.signature of Alias('username', 'jwtlib.models.app.LoginRequest.username')>",
|
|
"docstring": null
|
|
},
|
|
"password": {
|
|
"name": "password",
|
|
"kind": "attribute",
|
|
"path": "jwtlib.LoginRequest.password",
|
|
"signature": "<bound method Alias.signature of Alias('password', 'jwtlib.models.app.LoginRequest.password')>",
|
|
"docstring": null
|
|
}
|
|
}
|
|
},
|
|
"LoginResponse": {
|
|
"name": "LoginResponse",
|
|
"kind": "class",
|
|
"path": "jwtlib.LoginResponse",
|
|
"signature": "<bound method Alias.signature of Alias('LoginResponse', 'jwtlib.models.LoginResponse')>",
|
|
"docstring": "Response returned after successful authentication.\n\nAttributes:\n access_token (str):\n `JWT` access token for authenticated requests.\n user (PublicUser):\n Public profile of the authenticated user.",
|
|
"members": {
|
|
"access_token": {
|
|
"name": "access_token",
|
|
"kind": "attribute",
|
|
"path": "jwtlib.LoginResponse.access_token",
|
|
"signature": "<bound method Alias.signature of Alias('access_token', 'jwtlib.models.app.LoginResponse.access_token')>",
|
|
"docstring": null
|
|
},
|
|
"user": {
|
|
"name": "user",
|
|
"kind": "attribute",
|
|
"path": "jwtlib.LoginResponse.user",
|
|
"signature": "<bound method Alias.signature of Alias('user', 'jwtlib.models.app.LoginResponse.user')>",
|
|
"docstring": null
|
|
},
|
|
"model_config": {
|
|
"name": "model_config",
|
|
"kind": "attribute",
|
|
"path": "jwtlib.LoginResponse.model_config",
|
|
"signature": "<bound method Alias.signature of Alias('model_config', 'jwtlib.models.app.LoginResponse.model_config')>",
|
|
"docstring": null
|
|
}
|
|
}
|
|
},
|
|
"LogoutResponse": {
|
|
"name": "LogoutResponse",
|
|
"kind": "class",
|
|
"path": "jwtlib.LogoutResponse",
|
|
"signature": "<bound method Alias.signature of Alias('LogoutResponse', 'jwtlib.models.LogoutResponse')>",
|
|
"docstring": "Response returned after a logout operation.\n\nAttributes:\n message (str):\n Human-readable logout confirmation.",
|
|
"members": {
|
|
"message": {
|
|
"name": "message",
|
|
"kind": "attribute",
|
|
"path": "jwtlib.LogoutResponse.message",
|
|
"signature": "<bound method Alias.signature of Alias('message', 'jwtlib.models.app.LogoutResponse.message')>",
|
|
"docstring": null
|
|
},
|
|
"model_config": {
|
|
"name": "model_config",
|
|
"kind": "attribute",
|
|
"path": "jwtlib.LogoutResponse.model_config",
|
|
"signature": "<bound method Alias.signature of Alias('model_config', 'jwtlib.models.app.LogoutResponse.model_config')>",
|
|
"docstring": null
|
|
}
|
|
}
|
|
},
|
|
"PublicUser": {
|
|
"name": "PublicUser",
|
|
"kind": "class",
|
|
"path": "jwtlib.PublicUser",
|
|
"signature": "<bound method Alias.signature of Alias('PublicUser', 'jwtlib.models.PublicUser')>",
|
|
"docstring": "Public-facing user representation returned by authentication APIs.\n\nAttributes:\n username (str):\n Unique username identifier.\n email (EmailStr, optional):\n User's email address.\n is_active (bool):\n Whether the user account is active.",
|
|
"members": {
|
|
"model_config": {
|
|
"name": "model_config",
|
|
"kind": "attribute",
|
|
"path": "jwtlib.PublicUser.model_config",
|
|
"signature": "<bound method Alias.signature of Alias('model_config', 'jwtlib.models.app.PublicUser.model_config')>",
|
|
"docstring": null
|
|
},
|
|
"username": {
|
|
"name": "username",
|
|
"kind": "attribute",
|
|
"path": "jwtlib.PublicUser.username",
|
|
"signature": "<bound method Alias.signature of Alias('username', 'jwtlib.models.app.PublicUser.username')>",
|
|
"docstring": null
|
|
},
|
|
"email": {
|
|
"name": "email",
|
|
"kind": "attribute",
|
|
"path": "jwtlib.PublicUser.email",
|
|
"signature": "<bound method Alias.signature of Alias('email', 'jwtlib.models.app.PublicUser.email')>",
|
|
"docstring": null
|
|
},
|
|
"is_active": {
|
|
"name": "is_active",
|
|
"kind": "attribute",
|
|
"path": "jwtlib.PublicUser.is_active",
|
|
"signature": "<bound method Alias.signature of Alias('is_active', 'jwtlib.models.app.PublicUser.is_active')>",
|
|
"docstring": null
|
|
}
|
|
}
|
|
},
|
|
"TokenPayload": {
|
|
"name": "TokenPayload",
|
|
"kind": "class",
|
|
"path": "jwtlib.TokenPayload",
|
|
"signature": "<bound method Alias.signature of Alias('TokenPayload', 'jwtlib.models.TokenPayload')>",
|
|
"docstring": "Decoded `JWT` payload.\n\nAttributes:\n sub (str):\n Subject claim identifying the user (typically a username or user ID).\n exp (int):\n Expiration time as a Unix timestamp (seconds since epoch).\n\nNotes:\n **Responsibilities:**\n\n - Represents the validated claims extracted from a `JWT` after\n signature verification. This model is used internally to enforce\n required claims and provide a typed interface to token data.\n\n **Guarantees:**\n\n - This model assumes the `JWT` signature has already been verified.\n No authorization decisions should be made solely on this model.\n Additional claims may exist but are intentionally ignored.",
|
|
"members": {
|
|
"sub": {
|
|
"name": "sub",
|
|
"kind": "attribute",
|
|
"path": "jwtlib.TokenPayload.sub",
|
|
"signature": "<bound method Alias.signature of Alias('sub', 'jwtlib.models.security.TokenPayload.sub')>",
|
|
"docstring": null
|
|
},
|
|
"exp": {
|
|
"name": "exp",
|
|
"kind": "attribute",
|
|
"path": "jwtlib.TokenPayload.exp",
|
|
"signature": "<bound method Alias.signature of Alias('exp', 'jwtlib.models.security.TokenPayload.exp')>",
|
|
"docstring": null
|
|
}
|
|
}
|
|
},
|
|
"IntrospectRequest": {
|
|
"name": "IntrospectRequest",
|
|
"kind": "class",
|
|
"path": "jwtlib.IntrospectRequest",
|
|
"signature": "<bound method Alias.signature of Alias('IntrospectRequest', 'jwtlib.models.IntrospectRequest')>",
|
|
"docstring": "Payload for requesting token introspection.\n\nAttributes:\n token (str):\n `JWT` access token to introspect.",
|
|
"members": {
|
|
"token": {
|
|
"name": "token",
|
|
"kind": "attribute",
|
|
"path": "jwtlib.IntrospectRequest.token",
|
|
"signature": "<bound method Alias.signature of Alias('token', 'jwtlib.models.app.IntrospectRequest.token')>",
|
|
"docstring": null
|
|
},
|
|
"model_config": {
|
|
"name": "model_config",
|
|
"kind": "attribute",
|
|
"path": "jwtlib.IntrospectRequest.model_config",
|
|
"signature": "<bound method Alias.signature of Alias('model_config', 'jwtlib.models.app.IntrospectRequest.model_config')>",
|
|
"docstring": null
|
|
}
|
|
}
|
|
},
|
|
"IntrospectResponse": {
|
|
"name": "IntrospectResponse",
|
|
"kind": "class",
|
|
"path": "jwtlib.IntrospectResponse",
|
|
"signature": "<bound method Alias.signature of Alias('IntrospectResponse', 'jwtlib.models.IntrospectResponse')>",
|
|
"docstring": "Result of a token introspection operation.\n\nAttributes:\n active (bool):\n Indicates whether the token is valid and active.\n user (Optional[PublicUser]):\n Public user details if the token is valid; otherwise null.",
|
|
"members": {
|
|
"active": {
|
|
"name": "active",
|
|
"kind": "attribute",
|
|
"path": "jwtlib.IntrospectResponse.active",
|
|
"signature": "<bound method Alias.signature of Alias('active', 'jwtlib.models.app.IntrospectResponse.active')>",
|
|
"docstring": null
|
|
},
|
|
"user": {
|
|
"name": "user",
|
|
"kind": "attribute",
|
|
"path": "jwtlib.IntrospectResponse.user",
|
|
"signature": "<bound method Alias.signature of Alias('user', 'jwtlib.models.app.IntrospectResponse.user')>",
|
|
"docstring": null
|
|
},
|
|
"model_config": {
|
|
"name": "model_config",
|
|
"kind": "attribute",
|
|
"path": "jwtlib.IntrospectResponse.model_config",
|
|
"signature": "<bound method Alias.signature of Alias('model_config', 'jwtlib.models.app.IntrospectResponse.model_config')>",
|
|
"docstring": null
|
|
},
|
|
"jwt_error": {
|
|
"name": "jwt_error",
|
|
"kind": "function",
|
|
"path": "jwtlib.IntrospectResponse.jwt_error",
|
|
"signature": "<bound method Alias.signature of Alias('jwt_error', 'jwtlib.models.app.IntrospectResponse.jwt_error')>",
|
|
"docstring": null
|
|
},
|
|
"no_username": {
|
|
"name": "no_username",
|
|
"kind": "function",
|
|
"path": "jwtlib.IntrospectResponse.no_username",
|
|
"signature": "<bound method Alias.signature of Alias('no_username', 'jwtlib.models.app.IntrospectResponse.no_username')>",
|
|
"docstring": null
|
|
},
|
|
"no_user": {
|
|
"name": "no_user",
|
|
"kind": "function",
|
|
"path": "jwtlib.IntrospectResponse.no_user",
|
|
"signature": "<bound method Alias.signature of Alias('no_user', 'jwtlib.models.app.IntrospectResponse.no_user')>",
|
|
"docstring": null
|
|
},
|
|
"valid_user": {
|
|
"name": "valid_user",
|
|
"kind": "function",
|
|
"path": "jwtlib.IntrospectResponse.valid_user",
|
|
"signature": "<bound method Alias.signature of Alias('valid_user', 'jwtlib.models.app.IntrospectResponse.valid_user')>",
|
|
"docstring": null
|
|
}
|
|
}
|
|
},
|
|
"register_user": {
|
|
"name": "register_user",
|
|
"kind": "function",
|
|
"path": "jwtlib.register_user",
|
|
"signature": "<bound method Alias.signature of Alias('register_user', 'jwtlib.app.register_user')>",
|
|
"docstring": "Register a new user.\n\nArgs:\n user (RegisterRequest):\n Registration payload containing username, email, and password.\n repo (UserRepository | None):\n Optional user repository instance. If not provided, a default\n repository is obtained via dependency utilities.\n\nReturns:\n PublicUser:\n The newly created user as a public user representation."
|
|
},
|
|
"login_user": {
|
|
"name": "login_user",
|
|
"kind": "function",
|
|
"path": "jwtlib.login_user",
|
|
"signature": "<bound method Alias.signature of Alias('login_user', 'jwtlib.app.login_user')>",
|
|
"docstring": "Authenticate a user and issue an access token.\n\nArgs:\n user (LoginRequest):\n Login payload containing username and password.\n repo (UserRepository | None):\n Optional user repository instance. If not provided, a default\n repository is obtained via dependency utilities.\n\nReturns:\n LoginResponse:\n `LoginResponse` containing the issued access token and related\n metadata.\n\nRaises:\n AuthError:\n If the credentials are invalid."
|
|
},
|
|
"get_logged_in_user": {
|
|
"name": "get_logged_in_user",
|
|
"kind": "function",
|
|
"path": "jwtlib.get_logged_in_user",
|
|
"signature": "<bound method Alias.signature of Alias('get_logged_in_user', 'jwtlib.app.get_logged_in_user')>",
|
|
"docstring": "Resolve the currently authenticated user from a `JWT`.\n\nArgs:\n token (str):\n `JWT` access token.\n repo (UserRepository | None):\n Optional user repository instance. If not provided, a default\n repository is obtained via dependency utilities.\n\nReturns:\n PublicUser:\n The authenticated user as a `PublicUser`.\n\nRaises:\n InvalidToken:\n If the token is missing, malformed, or invalid.\n AuthError:\n If the token is valid, but the user cannot be resolved."
|
|
},
|
|
"logout_user": {
|
|
"name": "logout_user",
|
|
"kind": "function",
|
|
"path": "jwtlib.logout_user",
|
|
"signature": "<bound method Alias.signature of Alias('logout_user', 'jwtlib.app.logout_user')>",
|
|
"docstring": "Perform a stateless logout.\n\nReturns:\n LogoutResponse:\n `LogoutResponse` containing a logout confirmation message.\n\nNotes:\n **Guarantees:**\n\n - This function does not invalidate tokens server-side. Instead, it\n provides a standardized response indicating that the client must\n discard its token."
|
|
},
|
|
"introspect_token": {
|
|
"name": "introspect_token",
|
|
"kind": "function",
|
|
"path": "jwtlib.introspect_token",
|
|
"signature": "<bound method Alias.signature of Alias('introspect_token', 'jwtlib.app.introspect_token')>",
|
|
"docstring": "Introspect a `JWT` for service-to-service authentication.\n\nArgs:\n token (str):\n `JWT` access token to introspect.\n repo (UserRepository | None):\n Optional user repository instance. If not provided, a default\n repository is obtained via dependency utilities.\n\nReturns:\n IntrospectResponse:\n `IntrospectResponse` indicating valid token with user, invalid\n token, or valid token with no user.\n\nNotes:\n **Responsibilities:**\n\n - Validate the provided token and resolve the associated user,\n returning a structured introspection response suitable for\n internal service use.\n\n **Guarantees:**\n\n - This function never raises authentication exceptions. Instead, it\n returns a typed response indicating token validity and user\n presence."
|
|
},
|
|
"authenticate_request": {
|
|
"name": "authenticate_request",
|
|
"kind": "function",
|
|
"path": "jwtlib.authenticate_request",
|
|
"signature": "<bound method Alias.signature of Alias('authenticate_request', 'jwtlib.introspection.authenticate_request')>",
|
|
"docstring": "Authenticate an incoming request using token introspection.\n\nArgs:\n should_skip_authentication (Callable[[str, str], bool]):\n Callable that decides whether authentication is required for a given HTTP method and path.\n method (str):\n HTTP method of the incoming request.\n path (str):\n Request path.\n authorization_token (str | None):\n JWT access token provided by the caller.\n\nReturns:\n PublicUser | None:\n PublicUser if authentication succeeds; None if authentication is skipped.\n\nRaises:\n InvalidToken:\n If authentication is required but the token is missing, invalid, or revoked.\n AuthServiceUnavailable:\n If the auth service cannot be reached.\n\nNotes:\n **Responsibilities:**\n\n - Determines whether authentication should be skipped for the given request context and, if not, resolves the authenticated user via token introspection\n\n **Guarantees:**\n\n - This function does not parse Authorization headers; callers must supply the raw token. Access-control policy is externalized via `should_skip_authentication`."
|
|
},
|
|
"AuthError": {
|
|
"name": "AuthError",
|
|
"kind": "class",
|
|
"path": "jwtlib.AuthError",
|
|
"signature": "<bound method Alias.signature of Alias('AuthError', 'jwtlib.exceptions.AuthError')>",
|
|
"docstring": "Base authentication and authorization error.\n\nNotes:\n **Guarantees:**\n\n - All authentication-related exceptions raised by this library\n inherit from this class.\n - Consumers may catch this exception to handle all auth failures\n uniformly."
|
|
},
|
|
"InvalidToken": {
|
|
"name": "InvalidToken",
|
|
"kind": "class",
|
|
"path": "jwtlib.InvalidToken",
|
|
"signature": "<bound method Alias.signature of Alias('InvalidToken', 'jwtlib.exceptions.InvalidToken')>",
|
|
"docstring": "Raised when a `JWT` is missing, malformed, expired, or invalid.\n\nNotes:\n **Guarantees:**\n\n - This error indicates that the provided token cannot be used to\n authenticate a request."
|
|
},
|
|
"UserNotFound": {
|
|
"name": "UserNotFound",
|
|
"kind": "class",
|
|
"path": "jwtlib.UserNotFound",
|
|
"signature": "<bound method Alias.signature of Alias('UserNotFound', 'jwtlib.exceptions.UserNotFound')>",
|
|
"docstring": "Raised when a valid token does not map to an existing user.\n\nNotes:\n **Guarantees:**\n\n - Indicates that authentication succeeded at the token level, but\n the associated user record could not be resolved."
|
|
},
|
|
"app": {
|
|
"name": "app",
|
|
"kind": "module",
|
|
"path": "jwtlib.app",
|
|
"signature": null,
|
|
"docstring": "# Summary\n\nApplication-level authentication logic.\n\nThis module contains **pure authentication and introspection logic** with no\nframework or transport coupling. It is intended to be used by HTTP adapters,\nCLIs, background workers, and other services that require `JWT`-based\nauthentication and user resolution.\n\nNotes:\n **Responsibilities:**\n\n - User registration and login.\n - Stateless logout semantics.\n - Current-user resolution from `JWT`s.\n - Service-to-service token introspection.\n\n **Constraints:**\n\n - This module intentionally does NOT:\n - Define HTTP routes.\n - Manage sessions.\n - Perform request parsing or response formatting.\n - Handle transport-level concerns.",
|
|
"members": {
|
|
"AuthError": {
|
|
"name": "AuthError",
|
|
"kind": "class",
|
|
"path": "jwtlib.app.AuthError",
|
|
"signature": "<bound method Alias.signature of Alias('AuthError', 'jwtlib.exceptions.AuthError')>",
|
|
"docstring": "Base authentication and authorization error.\n\nNotes:\n **Guarantees:**\n\n - All authentication-related exceptions raised by this library\n inherit from this class.\n - Consumers may catch this exception to handle all auth failures\n uniformly."
|
|
},
|
|
"InvalidToken": {
|
|
"name": "InvalidToken",
|
|
"kind": "class",
|
|
"path": "jwtlib.app.InvalidToken",
|
|
"signature": "<bound method Alias.signature of Alias('InvalidToken', 'jwtlib.exceptions.InvalidToken')>",
|
|
"docstring": "Raised when a `JWT` is missing, malformed, expired, or invalid.\n\nNotes:\n **Guarantees:**\n\n - This error indicates that the provided token cannot be used to\n authenticate a request."
|
|
},
|
|
"IntrospectResponse": {
|
|
"name": "IntrospectResponse",
|
|
"kind": "class",
|
|
"path": "jwtlib.app.IntrospectResponse",
|
|
"signature": "<bound method Alias.signature of Alias('IntrospectResponse', 'jwtlib.models.IntrospectResponse')>",
|
|
"docstring": "Result of a token introspection operation.\n\nAttributes:\n active (bool):\n Indicates whether the token is valid and active.\n user (Optional[PublicUser]):\n Public user details if the token is valid; otherwise null.",
|
|
"members": {
|
|
"active": {
|
|
"name": "active",
|
|
"kind": "attribute",
|
|
"path": "jwtlib.app.IntrospectResponse.active",
|
|
"signature": "<bound method Alias.signature of Alias('active', 'jwtlib.models.app.IntrospectResponse.active')>",
|
|
"docstring": null
|
|
},
|
|
"user": {
|
|
"name": "user",
|
|
"kind": "attribute",
|
|
"path": "jwtlib.app.IntrospectResponse.user",
|
|
"signature": "<bound method Alias.signature of Alias('user', 'jwtlib.models.app.IntrospectResponse.user')>",
|
|
"docstring": null
|
|
},
|
|
"model_config": {
|
|
"name": "model_config",
|
|
"kind": "attribute",
|
|
"path": "jwtlib.app.IntrospectResponse.model_config",
|
|
"signature": "<bound method Alias.signature of Alias('model_config', 'jwtlib.models.app.IntrospectResponse.model_config')>",
|
|
"docstring": null
|
|
},
|
|
"jwt_error": {
|
|
"name": "jwt_error",
|
|
"kind": "function",
|
|
"path": "jwtlib.app.IntrospectResponse.jwt_error",
|
|
"signature": "<bound method Alias.signature of Alias('jwt_error', 'jwtlib.models.app.IntrospectResponse.jwt_error')>",
|
|
"docstring": null
|
|
},
|
|
"no_username": {
|
|
"name": "no_username",
|
|
"kind": "function",
|
|
"path": "jwtlib.app.IntrospectResponse.no_username",
|
|
"signature": "<bound method Alias.signature of Alias('no_username', 'jwtlib.models.app.IntrospectResponse.no_username')>",
|
|
"docstring": null
|
|
},
|
|
"no_user": {
|
|
"name": "no_user",
|
|
"kind": "function",
|
|
"path": "jwtlib.app.IntrospectResponse.no_user",
|
|
"signature": "<bound method Alias.signature of Alias('no_user', 'jwtlib.models.app.IntrospectResponse.no_user')>",
|
|
"docstring": null
|
|
},
|
|
"valid_user": {
|
|
"name": "valid_user",
|
|
"kind": "function",
|
|
"path": "jwtlib.app.IntrospectResponse.valid_user",
|
|
"signature": "<bound method Alias.signature of Alias('valid_user', 'jwtlib.models.app.IntrospectResponse.valid_user')>",
|
|
"docstring": null
|
|
}
|
|
}
|
|
},
|
|
"LoginRequest": {
|
|
"name": "LoginRequest",
|
|
"kind": "class",
|
|
"path": "jwtlib.app.LoginRequest",
|
|
"signature": "<bound method Alias.signature of Alias('LoginRequest', 'jwtlib.models.LoginRequest')>",
|
|
"docstring": "Payload for authenticating a user and issuing a `JWT`.\n\nAttributes:\n username (str):\n Username identifier.\n password (str):\n Plain-text password to be verified.",
|
|
"members": {
|
|
"model_config": {
|
|
"name": "model_config",
|
|
"kind": "attribute",
|
|
"path": "jwtlib.app.LoginRequest.model_config",
|
|
"signature": "<bound method Alias.signature of Alias('model_config', 'jwtlib.models.app.LoginRequest.model_config')>",
|
|
"docstring": null
|
|
},
|
|
"username": {
|
|
"name": "username",
|
|
"kind": "attribute",
|
|
"path": "jwtlib.app.LoginRequest.username",
|
|
"signature": "<bound method Alias.signature of Alias('username', 'jwtlib.models.app.LoginRequest.username')>",
|
|
"docstring": null
|
|
},
|
|
"password": {
|
|
"name": "password",
|
|
"kind": "attribute",
|
|
"path": "jwtlib.app.LoginRequest.password",
|
|
"signature": "<bound method Alias.signature of Alias('password', 'jwtlib.models.app.LoginRequest.password')>",
|
|
"docstring": null
|
|
}
|
|
}
|
|
},
|
|
"LoginResponse": {
|
|
"name": "LoginResponse",
|
|
"kind": "class",
|
|
"path": "jwtlib.app.LoginResponse",
|
|
"signature": "<bound method Alias.signature of Alias('LoginResponse', 'jwtlib.models.LoginResponse')>",
|
|
"docstring": "Response returned after successful authentication.\n\nAttributes:\n access_token (str):\n `JWT` access token for authenticated requests.\n user (PublicUser):\n Public profile of the authenticated user.",
|
|
"members": {
|
|
"access_token": {
|
|
"name": "access_token",
|
|
"kind": "attribute",
|
|
"path": "jwtlib.app.LoginResponse.access_token",
|
|
"signature": "<bound method Alias.signature of Alias('access_token', 'jwtlib.models.app.LoginResponse.access_token')>",
|
|
"docstring": null
|
|
},
|
|
"user": {
|
|
"name": "user",
|
|
"kind": "attribute",
|
|
"path": "jwtlib.app.LoginResponse.user",
|
|
"signature": "<bound method Alias.signature of Alias('user', 'jwtlib.models.app.LoginResponse.user')>",
|
|
"docstring": null
|
|
},
|
|
"model_config": {
|
|
"name": "model_config",
|
|
"kind": "attribute",
|
|
"path": "jwtlib.app.LoginResponse.model_config",
|
|
"signature": "<bound method Alias.signature of Alias('model_config', 'jwtlib.models.app.LoginResponse.model_config')>",
|
|
"docstring": null
|
|
}
|
|
}
|
|
},
|
|
"LogoutResponse": {
|
|
"name": "LogoutResponse",
|
|
"kind": "class",
|
|
"path": "jwtlib.app.LogoutResponse",
|
|
"signature": "<bound method Alias.signature of Alias('LogoutResponse', 'jwtlib.models.LogoutResponse')>",
|
|
"docstring": "Response returned after a logout operation.\n\nAttributes:\n message (str):\n Human-readable logout confirmation.",
|
|
"members": {
|
|
"message": {
|
|
"name": "message",
|
|
"kind": "attribute",
|
|
"path": "jwtlib.app.LogoutResponse.message",
|
|
"signature": "<bound method Alias.signature of Alias('message', 'jwtlib.models.app.LogoutResponse.message')>",
|
|
"docstring": null
|
|
},
|
|
"model_config": {
|
|
"name": "model_config",
|
|
"kind": "attribute",
|
|
"path": "jwtlib.app.LogoutResponse.model_config",
|
|
"signature": "<bound method Alias.signature of Alias('model_config', 'jwtlib.models.app.LogoutResponse.model_config')>",
|
|
"docstring": null
|
|
}
|
|
}
|
|
},
|
|
"PublicUser": {
|
|
"name": "PublicUser",
|
|
"kind": "class",
|
|
"path": "jwtlib.app.PublicUser",
|
|
"signature": "<bound method Alias.signature of Alias('PublicUser', 'jwtlib.models.PublicUser')>",
|
|
"docstring": "Public-facing user representation returned by authentication APIs.\n\nAttributes:\n username (str):\n Unique username identifier.\n email (EmailStr, optional):\n User's email address.\n is_active (bool):\n Whether the user account is active.",
|
|
"members": {
|
|
"model_config": {
|
|
"name": "model_config",
|
|
"kind": "attribute",
|
|
"path": "jwtlib.app.PublicUser.model_config",
|
|
"signature": "<bound method Alias.signature of Alias('model_config', 'jwtlib.models.app.PublicUser.model_config')>",
|
|
"docstring": null
|
|
},
|
|
"username": {
|
|
"name": "username",
|
|
"kind": "attribute",
|
|
"path": "jwtlib.app.PublicUser.username",
|
|
"signature": "<bound method Alias.signature of Alias('username', 'jwtlib.models.app.PublicUser.username')>",
|
|
"docstring": null
|
|
},
|
|
"email": {
|
|
"name": "email",
|
|
"kind": "attribute",
|
|
"path": "jwtlib.app.PublicUser.email",
|
|
"signature": "<bound method Alias.signature of Alias('email', 'jwtlib.models.app.PublicUser.email')>",
|
|
"docstring": null
|
|
},
|
|
"is_active": {
|
|
"name": "is_active",
|
|
"kind": "attribute",
|
|
"path": "jwtlib.app.PublicUser.is_active",
|
|
"signature": "<bound method Alias.signature of Alias('is_active', 'jwtlib.models.app.PublicUser.is_active')>",
|
|
"docstring": null
|
|
}
|
|
}
|
|
},
|
|
"RegisterRequest": {
|
|
"name": "RegisterRequest",
|
|
"kind": "class",
|
|
"path": "jwtlib.app.RegisterRequest",
|
|
"signature": "<bound method Alias.signature of Alias('RegisterRequest', 'jwtlib.models.RegisterRequest')>",
|
|
"docstring": "Payload for registering a new user account.\n\nAttributes:\n username (str):\n Unique username identifier.\n email (EmailStr, optional):\n User's email address.\n password (str):\n Plain-text password (to be hashed by the repository layer).",
|
|
"members": {
|
|
"model_config": {
|
|
"name": "model_config",
|
|
"kind": "attribute",
|
|
"path": "jwtlib.app.RegisterRequest.model_config",
|
|
"signature": "<bound method Alias.signature of Alias('model_config', 'jwtlib.models.app.RegisterRequest.model_config')>",
|
|
"docstring": null
|
|
},
|
|
"username": {
|
|
"name": "username",
|
|
"kind": "attribute",
|
|
"path": "jwtlib.app.RegisterRequest.username",
|
|
"signature": "<bound method Alias.signature of Alias('username', 'jwtlib.models.app.RegisterRequest.username')>",
|
|
"docstring": null
|
|
},
|
|
"email": {
|
|
"name": "email",
|
|
"kind": "attribute",
|
|
"path": "jwtlib.app.RegisterRequest.email",
|
|
"signature": "<bound method Alias.signature of Alias('email', 'jwtlib.models.app.RegisterRequest.email')>",
|
|
"docstring": null
|
|
},
|
|
"password": {
|
|
"name": "password",
|
|
"kind": "attribute",
|
|
"path": "jwtlib.app.RegisterRequest.password",
|
|
"signature": "<bound method Alias.signature of Alias('password', 'jwtlib.models.app.RegisterRequest.password')>",
|
|
"docstring": null
|
|
}
|
|
}
|
|
},
|
|
"UserRepository": {
|
|
"name": "UserRepository",
|
|
"kind": "class",
|
|
"path": "jwtlib.app.UserRepository",
|
|
"signature": "<bound method Alias.signature of Alias('UserRepository', 'jwtlib.repository.UserRepository')>",
|
|
"docstring": "MongoDB-backed repository for `User` documents.\n\nNotes:\n **Responsibilities:**\n\n - Manage user persistence (CRUD).\n - Handle credential verification and token issuance.",
|
|
"members": {
|
|
"create": {
|
|
"name": "create",
|
|
"kind": "function",
|
|
"path": "jwtlib.app.UserRepository.create",
|
|
"signature": "<bound method Alias.signature of Alias('create', 'jwtlib.repository.UserRepository.create')>",
|
|
"docstring": "Create a new user record.\n\nArgs:\n user_create (RegisterRequest):\n Registration data including prospective password.\n\nReturns:\n PublicUser:\n A PublicUser representation of the created user."
|
|
},
|
|
"get_by_username": {
|
|
"name": "get_by_username",
|
|
"kind": "function",
|
|
"path": "jwtlib.app.UserRepository.get_by_username",
|
|
"signature": "<bound method Alias.signature of Alias('get_by_username', 'jwtlib.repository.UserRepository.get_by_username')>",
|
|
"docstring": "Retrieve a user by their unique username.\n\nArgs:\n username (str):\n The username to search for.\n\nReturns:\n User | None:\n The User document if found, otherwise None."
|
|
},
|
|
"get_by_email": {
|
|
"name": "get_by_email",
|
|
"kind": "function",
|
|
"path": "jwtlib.app.UserRepository.get_by_email",
|
|
"signature": "<bound method Alias.signature of Alias('get_by_email', 'jwtlib.repository.UserRepository.get_by_email')>",
|
|
"docstring": "Retrieve a user by their unique email address.\n\nArgs:\n email (str):\n The email address to search for.\n\nReturns:\n User | None:\n The User document if found, otherwise None."
|
|
},
|
|
"get_active_users": {
|
|
"name": "get_active_users",
|
|
"kind": "function",
|
|
"path": "jwtlib.app.UserRepository.get_active_users",
|
|
"signature": "<bound method Alias.signature of Alias('get_active_users', 'jwtlib.repository.UserRepository.get_active_users')>",
|
|
"docstring": "List all active users with pagination.\n\nArgs:\n skip (int):\n Number of records to skip.\n limit (int):\n Maximum number of records to return.\n\nReturns:\n list[User]:\n A list of active User documents."
|
|
},
|
|
"authenticate_user": {
|
|
"name": "authenticate_user",
|
|
"kind": "function",
|
|
"path": "jwtlib.app.UserRepository.authenticate_user",
|
|
"signature": "<bound method Alias.signature of Alias('authenticate_user', 'jwtlib.repository.UserRepository.authenticate_user')>",
|
|
"docstring": "Verify user credentials and prepare a login response.\n\nArgs:\n user_auth (LoginRequest):\n Login credentials.\n\nReturns:\n dict | None:\n A dictionary containing the access token and public user if successful, otherwise None."
|
|
}
|
|
}
|
|
},
|
|
"get_current_user": {
|
|
"name": "get_current_user",
|
|
"kind": "function",
|
|
"path": "jwtlib.app.get_current_user",
|
|
"signature": "<bound method Alias.signature of Alias('get_current_user', 'jwtlib.utils.get_current_user')>",
|
|
"docstring": "Validate token and return authenticated public user.\n\nArgs:\n token (str):\n The `JWT` string to validate.\n repo (UserRepository | None):\n The user repository to use for resolution.\n\nReturns:\n PublicUser:\n The resolved and validated user object.\n\nRaises:\n InvalidToken:\n If the token is missing, malformed, or invalid.\n UserNotFound:\n If the token is valid, but the user does not exist in the\n repository."
|
|
},
|
|
"get_user_repository": {
|
|
"name": "get_user_repository",
|
|
"kind": "function",
|
|
"path": "jwtlib.app.get_user_repository",
|
|
"signature": "<bound method Alias.signature of Alias('get_user_repository', 'jwtlib.utils.get_user_repository')>",
|
|
"docstring": "Return a singleton or new instance of the `UserRepository`.\n\nReturns:\n UserRepository:\n The user repository instance."
|
|
},
|
|
"get_validated_token_payload": {
|
|
"name": "get_validated_token_payload",
|
|
"kind": "function",
|
|
"path": "jwtlib.app.get_validated_token_payload",
|
|
"signature": "<bound method Alias.signature of Alias('get_validated_token_payload', 'jwtlib.utils.get_validated_token_payload')>",
|
|
"docstring": "Validate a `JWT` and return a typed payload.\n\nArgs:\n token (str):\n The `JWT` string to validate.\n\nReturns:\n TokenPayload:\n The validated and typed token payload.\n\nRaises:\n JWTError:\n If the token is invalid or malformed."
|
|
},
|
|
"register_user": {
|
|
"name": "register_user",
|
|
"kind": "function",
|
|
"path": "jwtlib.app.register_user",
|
|
"signature": "<bound method Function.signature of Function('register_user', 52, 72)>",
|
|
"docstring": "Register a new user.\n\nArgs:\n user (RegisterRequest):\n Registration payload containing username, email, and password.\n repo (UserRepository | None):\n Optional user repository instance. If not provided, a default\n repository is obtained via dependency utilities.\n\nReturns:\n PublicUser:\n The newly created user as a public user representation."
|
|
},
|
|
"login_user": {
|
|
"name": "login_user",
|
|
"kind": "function",
|
|
"path": "jwtlib.app.login_user",
|
|
"signature": "<bound method Function.signature of Function('login_user', 75, 105)>",
|
|
"docstring": "Authenticate a user and issue an access token.\n\nArgs:\n user (LoginRequest):\n Login payload containing username and password.\n repo (UserRepository | None):\n Optional user repository instance. If not provided, a default\n repository is obtained via dependency utilities.\n\nReturns:\n LoginResponse:\n `LoginResponse` containing the issued access token and related\n metadata.\n\nRaises:\n AuthError:\n If the credentials are invalid."
|
|
},
|
|
"get_logged_in_user": {
|
|
"name": "get_logged_in_user",
|
|
"kind": "function",
|
|
"path": "jwtlib.app.get_logged_in_user",
|
|
"signature": "<bound method Function.signature of Function('get_logged_in_user', 108, 134)>",
|
|
"docstring": "Resolve the currently authenticated user from a `JWT`.\n\nArgs:\n token (str):\n `JWT` access token.\n repo (UserRepository | None):\n Optional user repository instance. If not provided, a default\n repository is obtained via dependency utilities.\n\nReturns:\n PublicUser:\n The authenticated user as a `PublicUser`.\n\nRaises:\n InvalidToken:\n If the token is missing, malformed, or invalid.\n AuthError:\n If the token is valid, but the user cannot be resolved."
|
|
},
|
|
"logout_user": {
|
|
"name": "logout_user",
|
|
"kind": "function",
|
|
"path": "jwtlib.app.logout_user",
|
|
"signature": "<bound method Function.signature of Function('logout_user', 137, 155)>",
|
|
"docstring": "Perform a stateless logout.\n\nReturns:\n LogoutResponse:\n `LogoutResponse` containing a logout confirmation message.\n\nNotes:\n **Guarantees:**\n\n - This function does not invalidate tokens server-side. Instead, it\n provides a standardized response indicating that the client must\n discard its token."
|
|
},
|
|
"introspect_token": {
|
|
"name": "introspect_token",
|
|
"kind": "function",
|
|
"path": "jwtlib.app.introspect_token",
|
|
"signature": "<bound method Function.signature of Function('introspect_token', 163, 207)>",
|
|
"docstring": "Introspect a `JWT` for service-to-service authentication.\n\nArgs:\n token (str):\n `JWT` access token to introspect.\n repo (UserRepository | None):\n Optional user repository instance. If not provided, a default\n repository is obtained via dependency utilities.\n\nReturns:\n IntrospectResponse:\n `IntrospectResponse` indicating valid token with user, invalid\n token, or valid token with no user.\n\nNotes:\n **Responsibilities:**\n\n - Validate the provided token and resolve the associated user,\n returning a structured introspection response suitable for\n internal service use.\n\n **Guarantees:**\n\n - This function never raises authentication exceptions. Instead, it\n returns a typed response indicating token validity and user\n presence."
|
|
}
|
|
}
|
|
},
|
|
"exceptions": {
|
|
"name": "exceptions",
|
|
"kind": "module",
|
|
"path": "jwtlib.exceptions",
|
|
"signature": null,
|
|
"docstring": "# Summary\n\nAuthentication and authorization exceptions.\n\nThis module defines the exception hierarchy used throughout the\nauthentication library to represent authentication, authorization,\nand service-level failures.\n\nAll exceptions inherit from `AuthError`, allowing consumers to catch\nauthentication-related failures broadly or handle specific cases\nselectively.",
|
|
"members": {
|
|
"AuthError": {
|
|
"name": "AuthError",
|
|
"kind": "class",
|
|
"path": "jwtlib.exceptions.AuthError",
|
|
"signature": "<bound method Class.signature of Class('AuthError', 20, 31)>",
|
|
"docstring": "Base authentication and authorization error.\n\nNotes:\n **Guarantees:**\n\n - All authentication-related exceptions raised by this library\n inherit from this class.\n - Consumers may catch this exception to handle all auth failures\n uniformly."
|
|
},
|
|
"InvalidToken": {
|
|
"name": "InvalidToken",
|
|
"kind": "class",
|
|
"path": "jwtlib.exceptions.InvalidToken",
|
|
"signature": "<bound method Class.signature of Class('InvalidToken', 34, 43)>",
|
|
"docstring": "Raised when a `JWT` is missing, malformed, expired, or invalid.\n\nNotes:\n **Guarantees:**\n\n - This error indicates that the provided token cannot be used to\n authenticate a request."
|
|
},
|
|
"InvalidAuthorizationHeader": {
|
|
"name": "InvalidAuthorizationHeader",
|
|
"kind": "class",
|
|
"path": "jwtlib.exceptions.InvalidAuthorizationHeader",
|
|
"signature": "<bound method Class.signature of Class('InvalidAuthorizationHeader', 46, 56)>",
|
|
"docstring": "Raised when the `Authorization` header is missing or incorrectly\nformatted.\n\nNotes:\n **Guarantees:**\n\n - Indicates that the header is not present or does not follow the\n expected `Bearer <token>` format."
|
|
},
|
|
"UserNotFound": {
|
|
"name": "UserNotFound",
|
|
"kind": "class",
|
|
"path": "jwtlib.exceptions.UserNotFound",
|
|
"signature": "<bound method Class.signature of Class('UserNotFound', 59, 68)>",
|
|
"docstring": "Raised when a valid token does not map to an existing user.\n\nNotes:\n **Guarantees:**\n\n - Indicates that authentication succeeded at the token level, but\n the associated user record could not be resolved."
|
|
},
|
|
"AuthServiceUnavailable": {
|
|
"name": "AuthServiceUnavailable",
|
|
"kind": "class",
|
|
"path": "jwtlib.exceptions.AuthServiceUnavailable",
|
|
"signature": "<bound method Class.signature of Class('AuthServiceUnavailable', 71, 80)>",
|
|
"docstring": "Raised when the authentication service cannot be reached.\n\nNotes:\n **Guarantees:**\n\n - Indicates a network failure, timeout, or unexpected error while\n communicating with the auth service."
|
|
},
|
|
"NotAuthenticated": {
|
|
"name": "NotAuthenticated",
|
|
"kind": "class",
|
|
"path": "jwtlib.exceptions.NotAuthenticated",
|
|
"signature": "<bound method Class.signature of Class('NotAuthenticated', 83, 92)>",
|
|
"docstring": "Raised when authentication is required but no user context is present.\n\nNotes:\n **Guarantees:**\n\n - Typically used when attempting to access a protected operation\n without an authenticated user."
|
|
}
|
|
}
|
|
},
|
|
"introspection": {
|
|
"name": "introspection",
|
|
"kind": "module",
|
|
"path": "jwtlib.introspection",
|
|
"signature": null,
|
|
"docstring": "# Summary\n\nAuth client and access-control utilities.\n\nThis module provides **pure authentication and authorization logic**\nfor validating JWTs via service-to-service introspection and resolving\nauthenticated users.\n\nNotes:\n **Responsibilities:**\n\n - Calling the auth service introspection endpoint\n - Translating introspection responses into typed user models\n - Enforcing access control decisions at the logic layer\n\n **Constraints:**\n\n - This module intentionally does NOT: Parse HTTP requests or headers, implement authentication policies, or perform JWT signature verification locally.",
|
|
"members": {
|
|
"os": {
|
|
"name": "os",
|
|
"kind": "alias",
|
|
"path": "jwtlib.introspection.os",
|
|
"signature": "<bound method Alias.signature of Alias('os', 'os')>",
|
|
"docstring": null
|
|
},
|
|
"Callable": {
|
|
"name": "Callable",
|
|
"kind": "alias",
|
|
"path": "jwtlib.introspection.Callable",
|
|
"signature": "<bound method Alias.signature of Alias('Callable', 'collections.abc.Callable')>",
|
|
"docstring": null
|
|
},
|
|
"Any": {
|
|
"name": "Any",
|
|
"kind": "alias",
|
|
"path": "jwtlib.introspection.Any",
|
|
"signature": "<bound method Alias.signature of Alias('Any', 'typing.Any')>",
|
|
"docstring": null
|
|
},
|
|
"httpx": {
|
|
"name": "httpx",
|
|
"kind": "alias",
|
|
"path": "jwtlib.introspection.httpx",
|
|
"signature": "<bound method Alias.signature of Alias('httpx', 'httpx')>",
|
|
"docstring": null
|
|
},
|
|
"AuthServiceUnavailable": {
|
|
"name": "AuthServiceUnavailable",
|
|
"kind": "class",
|
|
"path": "jwtlib.introspection.AuthServiceUnavailable",
|
|
"signature": "<bound method Alias.signature of Alias('AuthServiceUnavailable', 'jwtlib.exceptions.AuthServiceUnavailable')>",
|
|
"docstring": "Raised when the authentication service cannot be reached.\n\nNotes:\n **Guarantees:**\n\n - Indicates a network failure, timeout, or unexpected error while\n communicating with the auth service."
|
|
},
|
|
"InvalidToken": {
|
|
"name": "InvalidToken",
|
|
"kind": "class",
|
|
"path": "jwtlib.introspection.InvalidToken",
|
|
"signature": "<bound method Alias.signature of Alias('InvalidToken', 'jwtlib.exceptions.InvalidToken')>",
|
|
"docstring": "Raised when a `JWT` is missing, malformed, expired, or invalid.\n\nNotes:\n **Guarantees:**\n\n - This error indicates that the provided token cannot be used to\n authenticate a request."
|
|
},
|
|
"PublicUser": {
|
|
"name": "PublicUser",
|
|
"kind": "class",
|
|
"path": "jwtlib.introspection.PublicUser",
|
|
"signature": "<bound method Alias.signature of Alias('PublicUser', 'jwtlib.models.PublicUser')>",
|
|
"docstring": "Public-facing user representation returned by authentication APIs.\n\nAttributes:\n username (str):\n Unique username identifier.\n email (EmailStr, optional):\n User's email address.\n is_active (bool):\n Whether the user account is active.",
|
|
"members": {
|
|
"model_config": {
|
|
"name": "model_config",
|
|
"kind": "attribute",
|
|
"path": "jwtlib.introspection.PublicUser.model_config",
|
|
"signature": "<bound method Alias.signature of Alias('model_config', 'jwtlib.models.app.PublicUser.model_config')>",
|
|
"docstring": null
|
|
},
|
|
"username": {
|
|
"name": "username",
|
|
"kind": "attribute",
|
|
"path": "jwtlib.introspection.PublicUser.username",
|
|
"signature": "<bound method Alias.signature of Alias('username', 'jwtlib.models.app.PublicUser.username')>",
|
|
"docstring": null
|
|
},
|
|
"email": {
|
|
"name": "email",
|
|
"kind": "attribute",
|
|
"path": "jwtlib.introspection.PublicUser.email",
|
|
"signature": "<bound method Alias.signature of Alias('email', 'jwtlib.models.app.PublicUser.email')>",
|
|
"docstring": null
|
|
},
|
|
"is_active": {
|
|
"name": "is_active",
|
|
"kind": "attribute",
|
|
"path": "jwtlib.introspection.PublicUser.is_active",
|
|
"signature": "<bound method Alias.signature of Alias('is_active', 'jwtlib.models.app.PublicUser.is_active')>",
|
|
"docstring": null
|
|
}
|
|
}
|
|
},
|
|
"JWT_SERVER": {
|
|
"name": "JWT_SERVER",
|
|
"kind": "attribute",
|
|
"path": "jwtlib.introspection.JWT_SERVER",
|
|
"signature": null,
|
|
"docstring": null
|
|
},
|
|
"INTROSPECTION_URL": {
|
|
"name": "INTROSPECTION_URL",
|
|
"kind": "attribute",
|
|
"path": "jwtlib.introspection.INTROSPECTION_URL",
|
|
"signature": null,
|
|
"docstring": null
|
|
},
|
|
"introspect_token": {
|
|
"name": "introspect_token",
|
|
"kind": "function",
|
|
"path": "jwtlib.introspection.introspect_token",
|
|
"signature": "<bound method Function.signature of Function('introspect_token', 48, 92)>",
|
|
"docstring": "Introspect a JWT using the external authentication service.\n\nArgs:\n token (str):\n JWT access token to introspect.\n\nReturns:\n dict[str, Any]:\n A dictionary containing the authenticated user's public payload.\n\nRaises:\n InvalidToken:\n If the token is missing, invalid, inactive, or revoked.\n AuthServiceUnavailable:\n If the auth service cannot be reached or fails unexpectedly.\n\nNotes:\n **Guarantees:**\n\n - This function treats the auth service as the source of truth. No local JWT validation or signature checking is performed here. The returned payload is expected to be safe for public exposure."
|
|
},
|
|
"authenticate_request": {
|
|
"name": "authenticate_request",
|
|
"kind": "function",
|
|
"path": "jwtlib.introspection.authenticate_request",
|
|
"signature": "<bound method Function.signature of Function('authenticate_request', 100, 145)>",
|
|
"docstring": "Authenticate an incoming request using token introspection.\n\nArgs:\n should_skip_authentication (Callable[[str, str], bool]):\n Callable that decides whether authentication is required for a given HTTP method and path.\n method (str):\n HTTP method of the incoming request.\n path (str):\n Request path.\n authorization_token (str | None):\n JWT access token provided by the caller.\n\nReturns:\n PublicUser | None:\n PublicUser if authentication succeeds; None if authentication is skipped.\n\nRaises:\n InvalidToken:\n If authentication is required but the token is missing, invalid, or revoked.\n AuthServiceUnavailable:\n If the auth service cannot be reached.\n\nNotes:\n **Responsibilities:**\n\n - Determines whether authentication should be skipped for the given request context and, if not, resolves the authenticated user via token introspection\n\n **Guarantees:**\n\n - This function does not parse Authorization headers; callers must supply the raw token. Access-control policy is externalized via `should_skip_authentication`."
|
|
}
|
|
}
|
|
},
|
|
"repository": {
|
|
"name": "repository",
|
|
"kind": "module",
|
|
"path": "jwtlib.repository",
|
|
"signature": null,
|
|
"docstring": "# Summary\n\nUserRepository: Persistence layer for authentication.\n\nThis module defines the MongoDB-backed repository for managing user records,\nincluding creation, lookup, and credential verification.",
|
|
"members": {
|
|
"BaseRepository": {
|
|
"name": "BaseRepository",
|
|
"kind": "alias",
|
|
"path": "jwtlib.repository.BaseRepository",
|
|
"signature": "<bound method Alias.signature of Alias('BaseRepository', 'mongo_ops.BaseRepository')>",
|
|
"docstring": null
|
|
},
|
|
"LoginRequest": {
|
|
"name": "LoginRequest",
|
|
"kind": "class",
|
|
"path": "jwtlib.repository.LoginRequest",
|
|
"signature": "<bound method Alias.signature of Alias('LoginRequest', 'jwtlib.models.LoginRequest')>",
|
|
"docstring": "Payload for authenticating a user and issuing a `JWT`.\n\nAttributes:\n username (str):\n Username identifier.\n password (str):\n Plain-text password to be verified.",
|
|
"members": {
|
|
"model_config": {
|
|
"name": "model_config",
|
|
"kind": "attribute",
|
|
"path": "jwtlib.repository.LoginRequest.model_config",
|
|
"signature": "<bound method Alias.signature of Alias('model_config', 'jwtlib.models.app.LoginRequest.model_config')>",
|
|
"docstring": null
|
|
},
|
|
"username": {
|
|
"name": "username",
|
|
"kind": "attribute",
|
|
"path": "jwtlib.repository.LoginRequest.username",
|
|
"signature": "<bound method Alias.signature of Alias('username', 'jwtlib.models.app.LoginRequest.username')>",
|
|
"docstring": null
|
|
},
|
|
"password": {
|
|
"name": "password",
|
|
"kind": "attribute",
|
|
"path": "jwtlib.repository.LoginRequest.password",
|
|
"signature": "<bound method Alias.signature of Alias('password', 'jwtlib.models.app.LoginRequest.password')>",
|
|
"docstring": null
|
|
}
|
|
}
|
|
},
|
|
"PublicUser": {
|
|
"name": "PublicUser",
|
|
"kind": "class",
|
|
"path": "jwtlib.repository.PublicUser",
|
|
"signature": "<bound method Alias.signature of Alias('PublicUser', 'jwtlib.models.PublicUser')>",
|
|
"docstring": "Public-facing user representation returned by authentication APIs.\n\nAttributes:\n username (str):\n Unique username identifier.\n email (EmailStr, optional):\n User's email address.\n is_active (bool):\n Whether the user account is active.",
|
|
"members": {
|
|
"model_config": {
|
|
"name": "model_config",
|
|
"kind": "attribute",
|
|
"path": "jwtlib.repository.PublicUser.model_config",
|
|
"signature": "<bound method Alias.signature of Alias('model_config', 'jwtlib.models.app.PublicUser.model_config')>",
|
|
"docstring": null
|
|
},
|
|
"username": {
|
|
"name": "username",
|
|
"kind": "attribute",
|
|
"path": "jwtlib.repository.PublicUser.username",
|
|
"signature": "<bound method Alias.signature of Alias('username', 'jwtlib.models.app.PublicUser.username')>",
|
|
"docstring": null
|
|
},
|
|
"email": {
|
|
"name": "email",
|
|
"kind": "attribute",
|
|
"path": "jwtlib.repository.PublicUser.email",
|
|
"signature": "<bound method Alias.signature of Alias('email', 'jwtlib.models.app.PublicUser.email')>",
|
|
"docstring": null
|
|
},
|
|
"is_active": {
|
|
"name": "is_active",
|
|
"kind": "attribute",
|
|
"path": "jwtlib.repository.PublicUser.is_active",
|
|
"signature": "<bound method Alias.signature of Alias('is_active', 'jwtlib.models.app.PublicUser.is_active')>",
|
|
"docstring": null
|
|
}
|
|
}
|
|
},
|
|
"RegisterRequest": {
|
|
"name": "RegisterRequest",
|
|
"kind": "class",
|
|
"path": "jwtlib.repository.RegisterRequest",
|
|
"signature": "<bound method Alias.signature of Alias('RegisterRequest', 'jwtlib.models.RegisterRequest')>",
|
|
"docstring": "Payload for registering a new user account.\n\nAttributes:\n username (str):\n Unique username identifier.\n email (EmailStr, optional):\n User's email address.\n password (str):\n Plain-text password (to be hashed by the repository layer).",
|
|
"members": {
|
|
"model_config": {
|
|
"name": "model_config",
|
|
"kind": "attribute",
|
|
"path": "jwtlib.repository.RegisterRequest.model_config",
|
|
"signature": "<bound method Alias.signature of Alias('model_config', 'jwtlib.models.app.RegisterRequest.model_config')>",
|
|
"docstring": null
|
|
},
|
|
"username": {
|
|
"name": "username",
|
|
"kind": "attribute",
|
|
"path": "jwtlib.repository.RegisterRequest.username",
|
|
"signature": "<bound method Alias.signature of Alias('username', 'jwtlib.models.app.RegisterRequest.username')>",
|
|
"docstring": null
|
|
},
|
|
"email": {
|
|
"name": "email",
|
|
"kind": "attribute",
|
|
"path": "jwtlib.repository.RegisterRequest.email",
|
|
"signature": "<bound method Alias.signature of Alias('email', 'jwtlib.models.app.RegisterRequest.email')>",
|
|
"docstring": null
|
|
},
|
|
"password": {
|
|
"name": "password",
|
|
"kind": "attribute",
|
|
"path": "jwtlib.repository.RegisterRequest.password",
|
|
"signature": "<bound method Alias.signature of Alias('password', 'jwtlib.models.app.RegisterRequest.password')>",
|
|
"docstring": null
|
|
}
|
|
}
|
|
},
|
|
"User": {
|
|
"name": "User",
|
|
"kind": "class",
|
|
"path": "jwtlib.repository.User",
|
|
"signature": "<bound method Alias.signature of Alias('User', 'jwtlib.models.User')>",
|
|
"docstring": "Internal user persistence model.\n\nAttributes:\n hashed_password (str):\n Secure hash of the user's password.\n\nNotes:\n **Responsibilities:**\n\n - Represents a user record as stored in the database. Includes\n sensitive fields and is strictly confined to the persistence\n layer.\n\n **Guarantees:**\n\n - This model MUST NOT be returned from authentication APIs.\n Consumers should use `PublicUser` instead. Password verification\n is handled by the repository layer.",
|
|
"members": {
|
|
"hashed_password": {
|
|
"name": "hashed_password",
|
|
"kind": "attribute",
|
|
"path": "jwtlib.repository.User.hashed_password",
|
|
"signature": "<bound method Alias.signature of Alias('hashed_password', 'jwtlib.models.mongo.User.hashed_password')>",
|
|
"docstring": null
|
|
}
|
|
}
|
|
},
|
|
"create_access_token": {
|
|
"name": "create_access_token",
|
|
"kind": "function",
|
|
"path": "jwtlib.repository.create_access_token",
|
|
"signature": "<bound method Alias.signature of Alias('create_access_token', 'jwtlib.security.create_access_token')>",
|
|
"docstring": "Generate a new `JWT` access token.\n\nArgs:\n data (dict):\n Subject data to include in the token payload.\n expires_delta (timedelta | None):\n Optional expiration override.\n\nReturns:\n str:\n An encoded `JWT` string."
|
|
},
|
|
"hash_password": {
|
|
"name": "hash_password",
|
|
"kind": "function",
|
|
"path": "jwtlib.repository.hash_password",
|
|
"signature": "<bound method Alias.signature of Alias('hash_password', 'jwtlib.security.hash_password')>",
|
|
"docstring": "Hash a plain-text password using the configured crypt context.\n\nArgs:\n password (str):\n The plain-text password to hash.\n\nReturns:\n str:\n The secure hash string."
|
|
},
|
|
"verify_password": {
|
|
"name": "verify_password",
|
|
"kind": "function",
|
|
"path": "jwtlib.repository.verify_password",
|
|
"signature": "<bound method Alias.signature of Alias('verify_password', 'jwtlib.security.verify_password')>",
|
|
"docstring": "Verify a plain-text password against a stored hash.\n\nArgs:\n plain_password (str):\n The unhashed password provided by the user.\n hashed_password (str):\n The secure hash to verify against.\n\nReturns:\n bool:\n True if the password is valid, False otherwise."
|
|
},
|
|
"UserRepository": {
|
|
"name": "UserRepository",
|
|
"kind": "class",
|
|
"path": "jwtlib.repository.UserRepository",
|
|
"signature": "<bound method Class.signature of Class('UserRepository', 19, 117)>",
|
|
"docstring": "MongoDB-backed repository for `User` documents.\n\nNotes:\n **Responsibilities:**\n\n - Manage user persistence (CRUD).\n - Handle credential verification and token issuance.",
|
|
"members": {
|
|
"create": {
|
|
"name": "create",
|
|
"kind": "function",
|
|
"path": "jwtlib.repository.UserRepository.create",
|
|
"signature": "<bound method Function.signature of Function('create', 33, 52)>",
|
|
"docstring": "Create a new user record.\n\nArgs:\n user_create (RegisterRequest):\n Registration data including prospective password.\n\nReturns:\n PublicUser:\n A PublicUser representation of the created user."
|
|
},
|
|
"get_by_username": {
|
|
"name": "get_by_username",
|
|
"kind": "function",
|
|
"path": "jwtlib.repository.UserRepository.get_by_username",
|
|
"signature": "<bound method Function.signature of Function('get_by_username', 54, 67)>",
|
|
"docstring": "Retrieve a user by their unique username.\n\nArgs:\n username (str):\n The username to search for.\n\nReturns:\n User | None:\n The User document if found, otherwise None."
|
|
},
|
|
"get_by_email": {
|
|
"name": "get_by_email",
|
|
"kind": "function",
|
|
"path": "jwtlib.repository.UserRepository.get_by_email",
|
|
"signature": "<bound method Function.signature of Function('get_by_email', 69, 82)>",
|
|
"docstring": "Retrieve a user by their unique email address.\n\nArgs:\n email (str):\n The email address to search for.\n\nReturns:\n User | None:\n The User document if found, otherwise None."
|
|
},
|
|
"get_active_users": {
|
|
"name": "get_active_users",
|
|
"kind": "function",
|
|
"path": "jwtlib.repository.UserRepository.get_active_users",
|
|
"signature": "<bound method Function.signature of Function('get_active_users', 84, 98)>",
|
|
"docstring": "List all active users with pagination.\n\nArgs:\n skip (int):\n Number of records to skip.\n limit (int):\n Maximum number of records to return.\n\nReturns:\n list[User]:\n A list of active User documents."
|
|
},
|
|
"authenticate_user": {
|
|
"name": "authenticate_user",
|
|
"kind": "function",
|
|
"path": "jwtlib.repository.UserRepository.authenticate_user",
|
|
"signature": "<bound method Function.signature of Function('authenticate_user', 100, 117)>",
|
|
"docstring": "Verify user credentials and prepare a login response.\n\nArgs:\n user_auth (LoginRequest):\n Login credentials.\n\nReturns:\n dict | None:\n A dictionary containing the access token and public user if successful, otherwise None."
|
|
}
|
|
}
|
|
}
|
|
}
|
|
},
|
|
"security": {
|
|
"name": "security",
|
|
"kind": "module",
|
|
"path": "jwtlib.security",
|
|
"signature": null,
|
|
"docstring": "# Summary\n\nSecurity utilities: Password hashing and `JWT` management.\n\nThis module provides low-level cryptographic helpers for password\nhashing and `JWT` token lifecycle management. It serves as the\ncryptographic engine for the authentication library.",
|
|
"members": {
|
|
"os": {
|
|
"name": "os",
|
|
"kind": "alias",
|
|
"path": "jwtlib.security.os",
|
|
"signature": "<bound method Alias.signature of Alias('os', 'os')>",
|
|
"docstring": null
|
|
},
|
|
"datetime": {
|
|
"name": "datetime",
|
|
"kind": "alias",
|
|
"path": "jwtlib.security.datetime",
|
|
"signature": "<bound method Alias.signature of Alias('datetime', 'datetime.datetime')>",
|
|
"docstring": null
|
|
},
|
|
"timedelta": {
|
|
"name": "timedelta",
|
|
"kind": "alias",
|
|
"path": "jwtlib.security.timedelta",
|
|
"signature": "<bound method Alias.signature of Alias('timedelta', 'datetime.timedelta')>",
|
|
"docstring": null
|
|
},
|
|
"JWTError": {
|
|
"name": "JWTError",
|
|
"kind": "alias",
|
|
"path": "jwtlib.security.JWTError",
|
|
"signature": "<bound method Alias.signature of Alias('JWTError', 'jose.JWTError')>",
|
|
"docstring": null
|
|
},
|
|
"jwt": {
|
|
"name": "jwt",
|
|
"kind": "alias",
|
|
"path": "jwtlib.security.jwt",
|
|
"signature": "<bound method Alias.signature of Alias('jwt', 'jose.jwt')>",
|
|
"docstring": null
|
|
},
|
|
"CryptContext": {
|
|
"name": "CryptContext",
|
|
"kind": "alias",
|
|
"path": "jwtlib.security.CryptContext",
|
|
"signature": "<bound method Alias.signature of Alias('CryptContext', 'passlib.context.CryptContext')>",
|
|
"docstring": null
|
|
},
|
|
"TokenPayload": {
|
|
"name": "TokenPayload",
|
|
"kind": "class",
|
|
"path": "jwtlib.security.TokenPayload",
|
|
"signature": "<bound method Alias.signature of Alias('TokenPayload', 'jwtlib.models.TokenPayload')>",
|
|
"docstring": "Decoded `JWT` payload.\n\nAttributes:\n sub (str):\n Subject claim identifying the user (typically a username or user ID).\n exp (int):\n Expiration time as a Unix timestamp (seconds since epoch).\n\nNotes:\n **Responsibilities:**\n\n - Represents the validated claims extracted from a `JWT` after\n signature verification. This model is used internally to enforce\n required claims and provide a typed interface to token data.\n\n **Guarantees:**\n\n - This model assumes the `JWT` signature has already been verified.\n No authorization decisions should be made solely on this model.\n Additional claims may exist but are intentionally ignored.",
|
|
"members": {
|
|
"sub": {
|
|
"name": "sub",
|
|
"kind": "attribute",
|
|
"path": "jwtlib.security.TokenPayload.sub",
|
|
"signature": "<bound method Alias.signature of Alias('sub', 'jwtlib.models.security.TokenPayload.sub')>",
|
|
"docstring": null
|
|
},
|
|
"exp": {
|
|
"name": "exp",
|
|
"kind": "attribute",
|
|
"path": "jwtlib.security.TokenPayload.exp",
|
|
"signature": "<bound method Alias.signature of Alias('exp', 'jwtlib.models.security.TokenPayload.exp')>",
|
|
"docstring": null
|
|
}
|
|
}
|
|
},
|
|
"SECRET_KEY": {
|
|
"name": "SECRET_KEY",
|
|
"kind": "attribute",
|
|
"path": "jwtlib.security.SECRET_KEY",
|
|
"signature": null,
|
|
"docstring": null
|
|
},
|
|
"ALGORITHM": {
|
|
"name": "ALGORITHM",
|
|
"kind": "attribute",
|
|
"path": "jwtlib.security.ALGORITHM",
|
|
"signature": null,
|
|
"docstring": null
|
|
},
|
|
"ACCESS_TOKEN_EXPIRE_MINUTES": {
|
|
"name": "ACCESS_TOKEN_EXPIRE_MINUTES",
|
|
"kind": "attribute",
|
|
"path": "jwtlib.security.ACCESS_TOKEN_EXPIRE_MINUTES",
|
|
"signature": null,
|
|
"docstring": null
|
|
},
|
|
"pwd_context": {
|
|
"name": "pwd_context",
|
|
"kind": "attribute",
|
|
"path": "jwtlib.security.pwd_context",
|
|
"signature": null,
|
|
"docstring": null
|
|
},
|
|
"hash_password": {
|
|
"name": "hash_password",
|
|
"kind": "function",
|
|
"path": "jwtlib.security.hash_password",
|
|
"signature": "<bound method Function.signature of Function('hash_password', 29, 41)>",
|
|
"docstring": "Hash a plain-text password using the configured crypt context.\n\nArgs:\n password (str):\n The plain-text password to hash.\n\nReturns:\n str:\n The secure hash string."
|
|
},
|
|
"verify_password": {
|
|
"name": "verify_password",
|
|
"kind": "function",
|
|
"path": "jwtlib.security.verify_password",
|
|
"signature": "<bound method Function.signature of Function('verify_password', 44, 58)>",
|
|
"docstring": "Verify a plain-text password against a stored hash.\n\nArgs:\n plain_password (str):\n The unhashed password provided by the user.\n hashed_password (str):\n The secure hash to verify against.\n\nReturns:\n bool:\n True if the password is valid, False otherwise."
|
|
},
|
|
"create_access_token": {
|
|
"name": "create_access_token",
|
|
"kind": "function",
|
|
"path": "jwtlib.security.create_access_token",
|
|
"signature": "<bound method Function.signature of Function('create_access_token', 64, 86)>",
|
|
"docstring": "Generate a new `JWT` access token.\n\nArgs:\n data (dict):\n Subject data to include in the token payload.\n expires_delta (timedelta | None):\n Optional expiration override.\n\nReturns:\n str:\n An encoded `JWT` string."
|
|
},
|
|
"get_jwt_payload": {
|
|
"name": "get_jwt_payload",
|
|
"kind": "function",
|
|
"path": "jwtlib.security.get_jwt_payload",
|
|
"signature": "<bound method Function.signature of Function('get_jwt_payload', 89, 109)>",
|
|
"docstring": "Decode and validate a `JWT`, returning a strongly-typed payload.\n\nArgs:\n token (str):\n The `JWT` string to decode.\n\nReturns:\n TokenPayload:\n The decoded and typed token payload.\n\nRaises:\n JWTError:\n If the token is invalid, expired, or malformed."
|
|
}
|
|
}
|
|
},
|
|
"utils": {
|
|
"name": "utils",
|
|
"kind": "module",
|
|
"path": "jwtlib.utils",
|
|
"signature": null,
|
|
"docstring": "# Summary\n\nAuth Utilities: Token validation and user resolution.\n\nThis module provides high-level helpers for validating `JWT` payloads and\nresolving users, intended for use in dependency injection or middleware.",
|
|
"members": {
|
|
"JWTError": {
|
|
"name": "JWTError",
|
|
"kind": "alias",
|
|
"path": "jwtlib.utils.JWTError",
|
|
"signature": "<bound method Alias.signature of Alias('JWTError', 'jose.JWTError')>",
|
|
"docstring": null
|
|
},
|
|
"InvalidToken": {
|
|
"name": "InvalidToken",
|
|
"kind": "class",
|
|
"path": "jwtlib.utils.InvalidToken",
|
|
"signature": "<bound method Alias.signature of Alias('InvalidToken', 'jwtlib.exceptions.InvalidToken')>",
|
|
"docstring": "Raised when a `JWT` is missing, malformed, expired, or invalid.\n\nNotes:\n **Guarantees:**\n\n - This error indicates that the provided token cannot be used to\n authenticate a request."
|
|
},
|
|
"UserNotFound": {
|
|
"name": "UserNotFound",
|
|
"kind": "class",
|
|
"path": "jwtlib.utils.UserNotFound",
|
|
"signature": "<bound method Alias.signature of Alias('UserNotFound', 'jwtlib.exceptions.UserNotFound')>",
|
|
"docstring": "Raised when a valid token does not map to an existing user.\n\nNotes:\n **Guarantees:**\n\n - Indicates that authentication succeeded at the token level, but\n the associated user record could not be resolved."
|
|
},
|
|
"PublicUser": {
|
|
"name": "PublicUser",
|
|
"kind": "class",
|
|
"path": "jwtlib.utils.PublicUser",
|
|
"signature": "<bound method Alias.signature of Alias('PublicUser', 'jwtlib.models.PublicUser')>",
|
|
"docstring": "Public-facing user representation returned by authentication APIs.\n\nAttributes:\n username (str):\n Unique username identifier.\n email (EmailStr, optional):\n User's email address.\n is_active (bool):\n Whether the user account is active.",
|
|
"members": {
|
|
"model_config": {
|
|
"name": "model_config",
|
|
"kind": "attribute",
|
|
"path": "jwtlib.utils.PublicUser.model_config",
|
|
"signature": "<bound method Alias.signature of Alias('model_config', 'jwtlib.models.app.PublicUser.model_config')>",
|
|
"docstring": null
|
|
},
|
|
"username": {
|
|
"name": "username",
|
|
"kind": "attribute",
|
|
"path": "jwtlib.utils.PublicUser.username",
|
|
"signature": "<bound method Alias.signature of Alias('username', 'jwtlib.models.app.PublicUser.username')>",
|
|
"docstring": null
|
|
},
|
|
"email": {
|
|
"name": "email",
|
|
"kind": "attribute",
|
|
"path": "jwtlib.utils.PublicUser.email",
|
|
"signature": "<bound method Alias.signature of Alias('email', 'jwtlib.models.app.PublicUser.email')>",
|
|
"docstring": null
|
|
},
|
|
"is_active": {
|
|
"name": "is_active",
|
|
"kind": "attribute",
|
|
"path": "jwtlib.utils.PublicUser.is_active",
|
|
"signature": "<bound method Alias.signature of Alias('is_active', 'jwtlib.models.app.PublicUser.is_active')>",
|
|
"docstring": null
|
|
}
|
|
}
|
|
},
|
|
"TokenPayload": {
|
|
"name": "TokenPayload",
|
|
"kind": "class",
|
|
"path": "jwtlib.utils.TokenPayload",
|
|
"signature": "<bound method Alias.signature of Alias('TokenPayload', 'jwtlib.models.TokenPayload')>",
|
|
"docstring": "Decoded `JWT` payload.\n\nAttributes:\n sub (str):\n Subject claim identifying the user (typically a username or user ID).\n exp (int):\n Expiration time as a Unix timestamp (seconds since epoch).\n\nNotes:\n **Responsibilities:**\n\n - Represents the validated claims extracted from a `JWT` after\n signature verification. This model is used internally to enforce\n required claims and provide a typed interface to token data.\n\n **Guarantees:**\n\n - This model assumes the `JWT` signature has already been verified.\n No authorization decisions should be made solely on this model.\n Additional claims may exist but are intentionally ignored.",
|
|
"members": {
|
|
"sub": {
|
|
"name": "sub",
|
|
"kind": "attribute",
|
|
"path": "jwtlib.utils.TokenPayload.sub",
|
|
"signature": "<bound method Alias.signature of Alias('sub', 'jwtlib.models.security.TokenPayload.sub')>",
|
|
"docstring": null
|
|
},
|
|
"exp": {
|
|
"name": "exp",
|
|
"kind": "attribute",
|
|
"path": "jwtlib.utils.TokenPayload.exp",
|
|
"signature": "<bound method Alias.signature of Alias('exp', 'jwtlib.models.security.TokenPayload.exp')>",
|
|
"docstring": null
|
|
}
|
|
}
|
|
},
|
|
"UserRepository": {
|
|
"name": "UserRepository",
|
|
"kind": "class",
|
|
"path": "jwtlib.utils.UserRepository",
|
|
"signature": "<bound method Alias.signature of Alias('UserRepository', 'jwtlib.repository.UserRepository')>",
|
|
"docstring": "MongoDB-backed repository for `User` documents.\n\nNotes:\n **Responsibilities:**\n\n - Manage user persistence (CRUD).\n - Handle credential verification and token issuance.",
|
|
"members": {
|
|
"create": {
|
|
"name": "create",
|
|
"kind": "function",
|
|
"path": "jwtlib.utils.UserRepository.create",
|
|
"signature": "<bound method Alias.signature of Alias('create', 'jwtlib.repository.UserRepository.create')>",
|
|
"docstring": "Create a new user record.\n\nArgs:\n user_create (RegisterRequest):\n Registration data including prospective password.\n\nReturns:\n PublicUser:\n A PublicUser representation of the created user."
|
|
},
|
|
"get_by_username": {
|
|
"name": "get_by_username",
|
|
"kind": "function",
|
|
"path": "jwtlib.utils.UserRepository.get_by_username",
|
|
"signature": "<bound method Alias.signature of Alias('get_by_username', 'jwtlib.repository.UserRepository.get_by_username')>",
|
|
"docstring": "Retrieve a user by their unique username.\n\nArgs:\n username (str):\n The username to search for.\n\nReturns:\n User | None:\n The User document if found, otherwise None."
|
|
},
|
|
"get_by_email": {
|
|
"name": "get_by_email",
|
|
"kind": "function",
|
|
"path": "jwtlib.utils.UserRepository.get_by_email",
|
|
"signature": "<bound method Alias.signature of Alias('get_by_email', 'jwtlib.repository.UserRepository.get_by_email')>",
|
|
"docstring": "Retrieve a user by their unique email address.\n\nArgs:\n email (str):\n The email address to search for.\n\nReturns:\n User | None:\n The User document if found, otherwise None."
|
|
},
|
|
"get_active_users": {
|
|
"name": "get_active_users",
|
|
"kind": "function",
|
|
"path": "jwtlib.utils.UserRepository.get_active_users",
|
|
"signature": "<bound method Alias.signature of Alias('get_active_users', 'jwtlib.repository.UserRepository.get_active_users')>",
|
|
"docstring": "List all active users with pagination.\n\nArgs:\n skip (int):\n Number of records to skip.\n limit (int):\n Maximum number of records to return.\n\nReturns:\n list[User]:\n A list of active User documents."
|
|
},
|
|
"authenticate_user": {
|
|
"name": "authenticate_user",
|
|
"kind": "function",
|
|
"path": "jwtlib.utils.UserRepository.authenticate_user",
|
|
"signature": "<bound method Alias.signature of Alias('authenticate_user', 'jwtlib.repository.UserRepository.authenticate_user')>",
|
|
"docstring": "Verify user credentials and prepare a login response.\n\nArgs:\n user_auth (LoginRequest):\n Login credentials.\n\nReturns:\n dict | None:\n A dictionary containing the access token and public user if successful, otherwise None."
|
|
}
|
|
}
|
|
},
|
|
"get_jwt_payload": {
|
|
"name": "get_jwt_payload",
|
|
"kind": "function",
|
|
"path": "jwtlib.utils.get_jwt_payload",
|
|
"signature": "<bound method Alias.signature of Alias('get_jwt_payload', 'jwtlib.security.get_jwt_payload')>",
|
|
"docstring": "Decode and validate a `JWT`, returning a strongly-typed payload.\n\nArgs:\n token (str):\n The `JWT` string to decode.\n\nReturns:\n TokenPayload:\n The decoded and typed token payload.\n\nRaises:\n JWTError:\n If the token is invalid, expired, or malformed."
|
|
},
|
|
"get_user_repository": {
|
|
"name": "get_user_repository",
|
|
"kind": "function",
|
|
"path": "jwtlib.utils.get_user_repository",
|
|
"signature": "<bound method Function.signature of Function('get_user_repository', 24, 32)>",
|
|
"docstring": "Return a singleton or new instance of the `UserRepository`.\n\nReturns:\n UserRepository:\n The user repository instance."
|
|
},
|
|
"get_current_user": {
|
|
"name": "get_current_user",
|
|
"kind": "function",
|
|
"path": "jwtlib.utils.get_current_user",
|
|
"signature": "<bound method Function.signature of Function('get_current_user', 38, 73)>",
|
|
"docstring": "Validate token and return authenticated public user.\n\nArgs:\n token (str):\n The `JWT` string to validate.\n repo (UserRepository | None):\n The user repository to use for resolution.\n\nReturns:\n PublicUser:\n The resolved and validated user object.\n\nRaises:\n InvalidToken:\n If the token is missing, malformed, or invalid.\n UserNotFound:\n If the token is valid, but the user does not exist in the\n repository."
|
|
},
|
|
"get_validated_token_payload": {
|
|
"name": "get_validated_token_payload",
|
|
"kind": "function",
|
|
"path": "jwtlib.utils.get_validated_token_payload",
|
|
"signature": "<bound method Function.signature of Function('get_validated_token_payload', 79, 100)>",
|
|
"docstring": "Validate a `JWT` and return a typed payload.\n\nArgs:\n token (str):\n The `JWT` string to validate.\n\nReturns:\n TokenPayload:\n The validated and typed token payload.\n\nRaises:\n JWTError:\n If the token is invalid or malformed."
|
|
}
|
|
}
|
|
},
|
|
"models": {
|
|
"name": "models",
|
|
"kind": "module",
|
|
"path": "jwtlib.models",
|
|
"signature": null,
|
|
"docstring": "# Summary\n\n`jwtlib` Models: Structured Data for Authentication.\n\nThis package defines the core data models used by `jwtlib`. These models are\ncategorized into request payloads, response objects, persistence documents,\nand security context.\n\n---\n\n# Model Categories\n\n**API Requests:**\n\n- `RegisterRequest`: Payload for creating new user accounts.\n- `LoginRequest`: User credentials for issuing `JWT`s.\n- `IntrospectRequest`: Internal payload for service-to-service token\n verification.\n\n**API Responses:**\n\n- `PublicUser`: A safe, non-sensitive projection of a user profile.\n- `LoginResponse`: Contains the issued access token and the `PublicUser`.\n- `LogoutResponse`: Instruction for clients to clear stateless session state.\n\n**Internal & Security:**\n\n- `User`: The MongoDB-backed persistence model (Confined to repository layer).\n- `TokenPayload`: Decoded claims from a validated `JWT` (`sub`, `exp`).\n- `IntrospectResponse`: Structured result of a token validity check.\n\n---\n\n# Usage\n\n**Validating an Auth Request:**\n\n```python\nfrom jwtlib.models import LoginRequest\nauth_data = LoginRequest(username=\"tester\", password=\"secure_password\")\n```\n\n**Projecting a User to Public View:**\n\n```python\nfrom jwtlib.models import User, PublicUser\nuser_profile = PublicUser.model_validate(db_user, from_attributes=True)\n```\n\n---\n\n# Public API\n\nThis package re-exports all **validated data models** required by the\nauthentication system. Consumers should import from this namespace\nto ensure type safety and consistency.\n\n- `LoginRequest` / `LoginResponse`\n- `RegisterRequest`\n- `LogoutResponse`\n- `PublicUser`\n- `IntrospectRequest` / `IntrospectResponse`\n- `User` (Persistence)\n- `TokenPayload` (`JWT`)\n\n---",
|
|
"members": {
|
|
"LoginRequest": {
|
|
"name": "LoginRequest",
|
|
"kind": "class",
|
|
"path": "jwtlib.models.LoginRequest",
|
|
"signature": "<bound method Alias.signature of Alias('LoginRequest', 'jwtlib.models.app.LoginRequest')>",
|
|
"docstring": "Payload for authenticating a user and issuing a `JWT`.\n\nAttributes:\n username (str):\n Username identifier.\n password (str):\n Plain-text password to be verified.",
|
|
"members": {
|
|
"model_config": {
|
|
"name": "model_config",
|
|
"kind": "attribute",
|
|
"path": "jwtlib.models.LoginRequest.model_config",
|
|
"signature": "<bound method Alias.signature of Alias('model_config', 'jwtlib.models.app.LoginRequest.model_config')>",
|
|
"docstring": null
|
|
},
|
|
"username": {
|
|
"name": "username",
|
|
"kind": "attribute",
|
|
"path": "jwtlib.models.LoginRequest.username",
|
|
"signature": "<bound method Alias.signature of Alias('username', 'jwtlib.models.app.LoginRequest.username')>",
|
|
"docstring": null
|
|
},
|
|
"password": {
|
|
"name": "password",
|
|
"kind": "attribute",
|
|
"path": "jwtlib.models.LoginRequest.password",
|
|
"signature": "<bound method Alias.signature of Alias('password', 'jwtlib.models.app.LoginRequest.password')>",
|
|
"docstring": null
|
|
}
|
|
}
|
|
},
|
|
"RegisterRequest": {
|
|
"name": "RegisterRequest",
|
|
"kind": "class",
|
|
"path": "jwtlib.models.RegisterRequest",
|
|
"signature": "<bound method Alias.signature of Alias('RegisterRequest', 'jwtlib.models.app.RegisterRequest')>",
|
|
"docstring": "Payload for registering a new user account.\n\nAttributes:\n username (str):\n Unique username identifier.\n email (EmailStr, optional):\n User's email address.\n password (str):\n Plain-text password (to be hashed by the repository layer).",
|
|
"members": {
|
|
"model_config": {
|
|
"name": "model_config",
|
|
"kind": "attribute",
|
|
"path": "jwtlib.models.RegisterRequest.model_config",
|
|
"signature": "<bound method Alias.signature of Alias('model_config', 'jwtlib.models.app.RegisterRequest.model_config')>",
|
|
"docstring": null
|
|
},
|
|
"username": {
|
|
"name": "username",
|
|
"kind": "attribute",
|
|
"path": "jwtlib.models.RegisterRequest.username",
|
|
"signature": "<bound method Alias.signature of Alias('username', 'jwtlib.models.app.RegisterRequest.username')>",
|
|
"docstring": null
|
|
},
|
|
"email": {
|
|
"name": "email",
|
|
"kind": "attribute",
|
|
"path": "jwtlib.models.RegisterRequest.email",
|
|
"signature": "<bound method Alias.signature of Alias('email', 'jwtlib.models.app.RegisterRequest.email')>",
|
|
"docstring": null
|
|
},
|
|
"password": {
|
|
"name": "password",
|
|
"kind": "attribute",
|
|
"path": "jwtlib.models.RegisterRequest.password",
|
|
"signature": "<bound method Alias.signature of Alias('password', 'jwtlib.models.app.RegisterRequest.password')>",
|
|
"docstring": null
|
|
}
|
|
}
|
|
},
|
|
"LoginResponse": {
|
|
"name": "LoginResponse",
|
|
"kind": "class",
|
|
"path": "jwtlib.models.LoginResponse",
|
|
"signature": "<bound method Alias.signature of Alias('LoginResponse', 'jwtlib.models.app.LoginResponse')>",
|
|
"docstring": "Response returned after successful authentication.\n\nAttributes:\n access_token (str):\n `JWT` access token for authenticated requests.\n user (PublicUser):\n Public profile of the authenticated user.",
|
|
"members": {
|
|
"access_token": {
|
|
"name": "access_token",
|
|
"kind": "attribute",
|
|
"path": "jwtlib.models.LoginResponse.access_token",
|
|
"signature": "<bound method Alias.signature of Alias('access_token', 'jwtlib.models.app.LoginResponse.access_token')>",
|
|
"docstring": null
|
|
},
|
|
"user": {
|
|
"name": "user",
|
|
"kind": "attribute",
|
|
"path": "jwtlib.models.LoginResponse.user",
|
|
"signature": "<bound method Alias.signature of Alias('user', 'jwtlib.models.app.LoginResponse.user')>",
|
|
"docstring": null
|
|
},
|
|
"model_config": {
|
|
"name": "model_config",
|
|
"kind": "attribute",
|
|
"path": "jwtlib.models.LoginResponse.model_config",
|
|
"signature": "<bound method Alias.signature of Alias('model_config', 'jwtlib.models.app.LoginResponse.model_config')>",
|
|
"docstring": null
|
|
}
|
|
}
|
|
},
|
|
"LogoutResponse": {
|
|
"name": "LogoutResponse",
|
|
"kind": "class",
|
|
"path": "jwtlib.models.LogoutResponse",
|
|
"signature": "<bound method Alias.signature of Alias('LogoutResponse', 'jwtlib.models.app.LogoutResponse')>",
|
|
"docstring": "Response returned after a logout operation.\n\nAttributes:\n message (str):\n Human-readable logout confirmation.",
|
|
"members": {
|
|
"message": {
|
|
"name": "message",
|
|
"kind": "attribute",
|
|
"path": "jwtlib.models.LogoutResponse.message",
|
|
"signature": "<bound method Alias.signature of Alias('message', 'jwtlib.models.app.LogoutResponse.message')>",
|
|
"docstring": null
|
|
},
|
|
"model_config": {
|
|
"name": "model_config",
|
|
"kind": "attribute",
|
|
"path": "jwtlib.models.LogoutResponse.model_config",
|
|
"signature": "<bound method Alias.signature of Alias('model_config', 'jwtlib.models.app.LogoutResponse.model_config')>",
|
|
"docstring": null
|
|
}
|
|
}
|
|
},
|
|
"PublicUser": {
|
|
"name": "PublicUser",
|
|
"kind": "class",
|
|
"path": "jwtlib.models.PublicUser",
|
|
"signature": "<bound method Alias.signature of Alias('PublicUser', 'jwtlib.models.app.PublicUser')>",
|
|
"docstring": "Public-facing user representation returned by authentication APIs.\n\nAttributes:\n username (str):\n Unique username identifier.\n email (EmailStr, optional):\n User's email address.\n is_active (bool):\n Whether the user account is active.",
|
|
"members": {
|
|
"model_config": {
|
|
"name": "model_config",
|
|
"kind": "attribute",
|
|
"path": "jwtlib.models.PublicUser.model_config",
|
|
"signature": "<bound method Alias.signature of Alias('model_config', 'jwtlib.models.app.PublicUser.model_config')>",
|
|
"docstring": null
|
|
},
|
|
"username": {
|
|
"name": "username",
|
|
"kind": "attribute",
|
|
"path": "jwtlib.models.PublicUser.username",
|
|
"signature": "<bound method Alias.signature of Alias('username', 'jwtlib.models.app.PublicUser.username')>",
|
|
"docstring": null
|
|
},
|
|
"email": {
|
|
"name": "email",
|
|
"kind": "attribute",
|
|
"path": "jwtlib.models.PublicUser.email",
|
|
"signature": "<bound method Alias.signature of Alias('email', 'jwtlib.models.app.PublicUser.email')>",
|
|
"docstring": null
|
|
},
|
|
"is_active": {
|
|
"name": "is_active",
|
|
"kind": "attribute",
|
|
"path": "jwtlib.models.PublicUser.is_active",
|
|
"signature": "<bound method Alias.signature of Alias('is_active', 'jwtlib.models.app.PublicUser.is_active')>",
|
|
"docstring": null
|
|
}
|
|
}
|
|
},
|
|
"IntrospectRequest": {
|
|
"name": "IntrospectRequest",
|
|
"kind": "class",
|
|
"path": "jwtlib.models.IntrospectRequest",
|
|
"signature": "<bound method Alias.signature of Alias('IntrospectRequest', 'jwtlib.models.app.IntrospectRequest')>",
|
|
"docstring": "Payload for requesting token introspection.\n\nAttributes:\n token (str):\n `JWT` access token to introspect.",
|
|
"members": {
|
|
"token": {
|
|
"name": "token",
|
|
"kind": "attribute",
|
|
"path": "jwtlib.models.IntrospectRequest.token",
|
|
"signature": "<bound method Alias.signature of Alias('token', 'jwtlib.models.app.IntrospectRequest.token')>",
|
|
"docstring": null
|
|
},
|
|
"model_config": {
|
|
"name": "model_config",
|
|
"kind": "attribute",
|
|
"path": "jwtlib.models.IntrospectRequest.model_config",
|
|
"signature": "<bound method Alias.signature of Alias('model_config', 'jwtlib.models.app.IntrospectRequest.model_config')>",
|
|
"docstring": null
|
|
}
|
|
}
|
|
},
|
|
"IntrospectResponse": {
|
|
"name": "IntrospectResponse",
|
|
"kind": "class",
|
|
"path": "jwtlib.models.IntrospectResponse",
|
|
"signature": "<bound method Alias.signature of Alias('IntrospectResponse', 'jwtlib.models.app.IntrospectResponse')>",
|
|
"docstring": "Result of a token introspection operation.\n\nAttributes:\n active (bool):\n Indicates whether the token is valid and active.\n user (Optional[PublicUser]):\n Public user details if the token is valid; otherwise null.",
|
|
"members": {
|
|
"active": {
|
|
"name": "active",
|
|
"kind": "attribute",
|
|
"path": "jwtlib.models.IntrospectResponse.active",
|
|
"signature": "<bound method Alias.signature of Alias('active', 'jwtlib.models.app.IntrospectResponse.active')>",
|
|
"docstring": null
|
|
},
|
|
"user": {
|
|
"name": "user",
|
|
"kind": "attribute",
|
|
"path": "jwtlib.models.IntrospectResponse.user",
|
|
"signature": "<bound method Alias.signature of Alias('user', 'jwtlib.models.app.IntrospectResponse.user')>",
|
|
"docstring": null
|
|
},
|
|
"model_config": {
|
|
"name": "model_config",
|
|
"kind": "attribute",
|
|
"path": "jwtlib.models.IntrospectResponse.model_config",
|
|
"signature": "<bound method Alias.signature of Alias('model_config', 'jwtlib.models.app.IntrospectResponse.model_config')>",
|
|
"docstring": null
|
|
},
|
|
"jwt_error": {
|
|
"name": "jwt_error",
|
|
"kind": "function",
|
|
"path": "jwtlib.models.IntrospectResponse.jwt_error",
|
|
"signature": "<bound method Alias.signature of Alias('jwt_error', 'jwtlib.models.app.IntrospectResponse.jwt_error')>",
|
|
"docstring": null
|
|
},
|
|
"no_username": {
|
|
"name": "no_username",
|
|
"kind": "function",
|
|
"path": "jwtlib.models.IntrospectResponse.no_username",
|
|
"signature": "<bound method Alias.signature of Alias('no_username', 'jwtlib.models.app.IntrospectResponse.no_username')>",
|
|
"docstring": null
|
|
},
|
|
"no_user": {
|
|
"name": "no_user",
|
|
"kind": "function",
|
|
"path": "jwtlib.models.IntrospectResponse.no_user",
|
|
"signature": "<bound method Alias.signature of Alias('no_user', 'jwtlib.models.app.IntrospectResponse.no_user')>",
|
|
"docstring": null
|
|
},
|
|
"valid_user": {
|
|
"name": "valid_user",
|
|
"kind": "function",
|
|
"path": "jwtlib.models.IntrospectResponse.valid_user",
|
|
"signature": "<bound method Alias.signature of Alias('valid_user', 'jwtlib.models.app.IntrospectResponse.valid_user')>",
|
|
"docstring": null
|
|
}
|
|
}
|
|
},
|
|
"User": {
|
|
"name": "User",
|
|
"kind": "class",
|
|
"path": "jwtlib.models.User",
|
|
"signature": "<bound method Alias.signature of Alias('User', 'jwtlib.models.mongo.User')>",
|
|
"docstring": "Internal user persistence model.\n\nAttributes:\n hashed_password (str):\n Secure hash of the user's password.\n\nNotes:\n **Responsibilities:**\n\n - Represents a user record as stored in the database. Includes\n sensitive fields and is strictly confined to the persistence\n layer.\n\n **Guarantees:**\n\n - This model MUST NOT be returned from authentication APIs.\n Consumers should use `PublicUser` instead. Password verification\n is handled by the repository layer.",
|
|
"members": {
|
|
"hashed_password": {
|
|
"name": "hashed_password",
|
|
"kind": "attribute",
|
|
"path": "jwtlib.models.User.hashed_password",
|
|
"signature": "<bound method Alias.signature of Alias('hashed_password', 'jwtlib.models.mongo.User.hashed_password')>",
|
|
"docstring": null
|
|
}
|
|
}
|
|
},
|
|
"TokenPayload": {
|
|
"name": "TokenPayload",
|
|
"kind": "class",
|
|
"path": "jwtlib.models.TokenPayload",
|
|
"signature": "<bound method Alias.signature of Alias('TokenPayload', 'jwtlib.models.security.TokenPayload')>",
|
|
"docstring": "Decoded `JWT` payload.\n\nAttributes:\n sub (str):\n Subject claim identifying the user (typically a username or user ID).\n exp (int):\n Expiration time as a Unix timestamp (seconds since epoch).\n\nNotes:\n **Responsibilities:**\n\n - Represents the validated claims extracted from a `JWT` after\n signature verification. This model is used internally to enforce\n required claims and provide a typed interface to token data.\n\n **Guarantees:**\n\n - This model assumes the `JWT` signature has already been verified.\n No authorization decisions should be made solely on this model.\n Additional claims may exist but are intentionally ignored.",
|
|
"members": {
|
|
"sub": {
|
|
"name": "sub",
|
|
"kind": "attribute",
|
|
"path": "jwtlib.models.TokenPayload.sub",
|
|
"signature": "<bound method Alias.signature of Alias('sub', 'jwtlib.models.security.TokenPayload.sub')>",
|
|
"docstring": null
|
|
},
|
|
"exp": {
|
|
"name": "exp",
|
|
"kind": "attribute",
|
|
"path": "jwtlib.models.TokenPayload.exp",
|
|
"signature": "<bound method Alias.signature of Alias('exp', 'jwtlib.models.security.TokenPayload.exp')>",
|
|
"docstring": null
|
|
}
|
|
}
|
|
},
|
|
"app": {
|
|
"name": "app",
|
|
"kind": "module",
|
|
"path": "jwtlib.models.app",
|
|
"signature": null,
|
|
"docstring": "# Summary\n\nAuthentication request and response models.\n\nThis module defines all **typed data models** used by the authentication\nlibrary for user registration, login, logout, and token introspection.\n\nNotes:\n **Model Categories:**\n\n - Request payloads used by authentication workflows.\n - Public response models exposed to consumers.\n - Introspection responses used for service-to-service authentication.\n\n **Design Principles:**\n\n - Fully typed (Pydantic v2).\n - Serialization-safe.\n - Framework-agnostic.\n - Suitable for both internal logic and external adapters.",
|
|
"members": {
|
|
"BaseModel": {
|
|
"name": "BaseModel",
|
|
"kind": "alias",
|
|
"path": "jwtlib.models.app.BaseModel",
|
|
"signature": "<bound method Alias.signature of Alias('BaseModel', 'pydantic.BaseModel')>",
|
|
"docstring": null
|
|
},
|
|
"Field": {
|
|
"name": "Field",
|
|
"kind": "alias",
|
|
"path": "jwtlib.models.app.Field",
|
|
"signature": "<bound method Alias.signature of Alias('Field', 'pydantic.Field')>",
|
|
"docstring": null
|
|
},
|
|
"ActiveStateMixin": {
|
|
"name": "ActiveStateMixin",
|
|
"kind": "class",
|
|
"path": "jwtlib.models.app.ActiveStateMixin",
|
|
"signature": "<bound method Alias.signature of Alias('ActiveStateMixin', 'jwtlib.models.common.ActiveStateMixin')>",
|
|
"docstring": "Mixin for entities with an active status flag.\n\nAttributes:\n is_active (bool):\n Indicates whether the account is active and allowed to\n authenticate.",
|
|
"members": {
|
|
"is_active": {
|
|
"name": "is_active",
|
|
"kind": "attribute",
|
|
"path": "jwtlib.models.app.ActiveStateMixin.is_active",
|
|
"signature": "<bound method Alias.signature of Alias('is_active', 'jwtlib.models.common.ActiveStateMixin.is_active')>",
|
|
"docstring": null
|
|
}
|
|
}
|
|
},
|
|
"IdentityMixin": {
|
|
"name": "IdentityMixin",
|
|
"kind": "class",
|
|
"path": "jwtlib.models.app.IdentityMixin",
|
|
"signature": "<bound method Alias.signature of Alias('IdentityMixin', 'jwtlib.models.common.IdentityMixin')>",
|
|
"docstring": "Mixin for entities with a username and email.\n\nAttributes:\n username (str):\n Unique username used for authentication and display.\n email (Optional[EmailStr]):\n Primary email address associated with the account.",
|
|
"members": {
|
|
"username": {
|
|
"name": "username",
|
|
"kind": "attribute",
|
|
"path": "jwtlib.models.app.IdentityMixin.username",
|
|
"signature": "<bound method Alias.signature of Alias('username', 'jwtlib.models.common.IdentityMixin.username')>",
|
|
"docstring": null
|
|
},
|
|
"email": {
|
|
"name": "email",
|
|
"kind": "attribute",
|
|
"path": "jwtlib.models.app.IdentityMixin.email",
|
|
"signature": "<bound method Alias.signature of Alias('email', 'jwtlib.models.common.IdentityMixin.email')>",
|
|
"docstring": null
|
|
}
|
|
}
|
|
},
|
|
"PasswordMixin": {
|
|
"name": "PasswordMixin",
|
|
"kind": "class",
|
|
"path": "jwtlib.models.app.PasswordMixin",
|
|
"signature": "<bound method Alias.signature of Alias('PasswordMixin', 'jwtlib.models.common.PasswordMixin')>",
|
|
"docstring": "Mixin for entities with a raw password field.\n\nAttributes:\n password (str):\n User password (minimum 6 characters).",
|
|
"members": {
|
|
"password": {
|
|
"name": "password",
|
|
"kind": "attribute",
|
|
"path": "jwtlib.models.app.PasswordMixin.password",
|
|
"signature": "<bound method Alias.signature of Alias('password', 'jwtlib.models.common.PasswordMixin.password')>",
|
|
"docstring": null
|
|
}
|
|
}
|
|
},
|
|
"User": {
|
|
"name": "User",
|
|
"kind": "class",
|
|
"path": "jwtlib.models.app.User",
|
|
"signature": "<bound method Alias.signature of Alias('User', 'jwtlib.models.mongo.User')>",
|
|
"docstring": "Internal user persistence model.\n\nAttributes:\n hashed_password (str):\n Secure hash of the user's password.\n\nNotes:\n **Responsibilities:**\n\n - Represents a user record as stored in the database. Includes\n sensitive fields and is strictly confined to the persistence\n layer.\n\n **Guarantees:**\n\n - This model MUST NOT be returned from authentication APIs.\n Consumers should use `PublicUser` instead. Password verification\n is handled by the repository layer.",
|
|
"members": {
|
|
"hashed_password": {
|
|
"name": "hashed_password",
|
|
"kind": "attribute",
|
|
"path": "jwtlib.models.app.User.hashed_password",
|
|
"signature": "<bound method Alias.signature of Alias('hashed_password', 'jwtlib.models.mongo.User.hashed_password')>",
|
|
"docstring": null
|
|
}
|
|
}
|
|
},
|
|
"RegisterRequest": {
|
|
"name": "RegisterRequest",
|
|
"kind": "class",
|
|
"path": "jwtlib.models.app.RegisterRequest",
|
|
"signature": "<bound method Class.signature of Class('RegisterRequest', 32, 53)>",
|
|
"docstring": "Payload for registering a new user account.\n\nAttributes:\n username (str):\n Unique username identifier.\n email (EmailStr, optional):\n User's email address.\n password (str):\n Plain-text password (to be hashed by the repository layer).",
|
|
"members": {
|
|
"model_config": {
|
|
"name": "model_config",
|
|
"kind": "attribute",
|
|
"path": "jwtlib.models.app.RegisterRequest.model_config",
|
|
"signature": null,
|
|
"docstring": null
|
|
},
|
|
"username": {
|
|
"name": "username",
|
|
"kind": "attribute",
|
|
"path": "jwtlib.models.app.RegisterRequest.username",
|
|
"signature": null,
|
|
"docstring": null
|
|
},
|
|
"email": {
|
|
"name": "email",
|
|
"kind": "attribute",
|
|
"path": "jwtlib.models.app.RegisterRequest.email",
|
|
"signature": null,
|
|
"docstring": null
|
|
},
|
|
"password": {
|
|
"name": "password",
|
|
"kind": "attribute",
|
|
"path": "jwtlib.models.app.RegisterRequest.password",
|
|
"signature": null,
|
|
"docstring": null
|
|
}
|
|
}
|
|
},
|
|
"LoginRequest": {
|
|
"name": "LoginRequest",
|
|
"kind": "class",
|
|
"path": "jwtlib.models.app.LoginRequest",
|
|
"signature": "<bound method Class.signature of Class('LoginRequest', 56, 71)>",
|
|
"docstring": "Payload for authenticating a user and issuing a `JWT`.\n\nAttributes:\n username (str):\n Username identifier.\n password (str):\n Plain-text password to be verified.",
|
|
"members": {
|
|
"model_config": {
|
|
"name": "model_config",
|
|
"kind": "attribute",
|
|
"path": "jwtlib.models.app.LoginRequest.model_config",
|
|
"signature": null,
|
|
"docstring": null
|
|
},
|
|
"username": {
|
|
"name": "username",
|
|
"kind": "attribute",
|
|
"path": "jwtlib.models.app.LoginRequest.username",
|
|
"signature": null,
|
|
"docstring": null
|
|
},
|
|
"password": {
|
|
"name": "password",
|
|
"kind": "attribute",
|
|
"path": "jwtlib.models.app.LoginRequest.password",
|
|
"signature": null,
|
|
"docstring": null
|
|
}
|
|
}
|
|
},
|
|
"IntrospectRequest": {
|
|
"name": "IntrospectRequest",
|
|
"kind": "class",
|
|
"path": "jwtlib.models.app.IntrospectRequest",
|
|
"signature": "<bound method Class.signature of Class('IntrospectRequest', 74, 93)>",
|
|
"docstring": "Payload for requesting token introspection.\n\nAttributes:\n token (str):\n `JWT` access token to introspect.",
|
|
"members": {
|
|
"token": {
|
|
"name": "token",
|
|
"kind": "attribute",
|
|
"path": "jwtlib.models.app.IntrospectRequest.token",
|
|
"signature": null,
|
|
"docstring": null
|
|
},
|
|
"model_config": {
|
|
"name": "model_config",
|
|
"kind": "attribute",
|
|
"path": "jwtlib.models.app.IntrospectRequest.model_config",
|
|
"signature": null,
|
|
"docstring": null
|
|
}
|
|
}
|
|
},
|
|
"PublicUser": {
|
|
"name": "PublicUser",
|
|
"kind": "class",
|
|
"path": "jwtlib.models.app.PublicUser",
|
|
"signature": "<bound method Class.signature of Class('PublicUser', 99, 121)>",
|
|
"docstring": "Public-facing user representation returned by authentication APIs.\n\nAttributes:\n username (str):\n Unique username identifier.\n email (EmailStr, optional):\n User's email address.\n is_active (bool):\n Whether the user account is active.",
|
|
"members": {
|
|
"model_config": {
|
|
"name": "model_config",
|
|
"kind": "attribute",
|
|
"path": "jwtlib.models.app.PublicUser.model_config",
|
|
"signature": null,
|
|
"docstring": null
|
|
},
|
|
"username": {
|
|
"name": "username",
|
|
"kind": "attribute",
|
|
"path": "jwtlib.models.app.PublicUser.username",
|
|
"signature": null,
|
|
"docstring": null
|
|
},
|
|
"email": {
|
|
"name": "email",
|
|
"kind": "attribute",
|
|
"path": "jwtlib.models.app.PublicUser.email",
|
|
"signature": null,
|
|
"docstring": null
|
|
},
|
|
"is_active": {
|
|
"name": "is_active",
|
|
"kind": "attribute",
|
|
"path": "jwtlib.models.app.PublicUser.is_active",
|
|
"signature": null,
|
|
"docstring": null
|
|
}
|
|
}
|
|
},
|
|
"LoginResponse": {
|
|
"name": "LoginResponse",
|
|
"kind": "class",
|
|
"path": "jwtlib.models.app.LoginResponse",
|
|
"signature": "<bound method Class.signature of Class('LoginResponse', 124, 154)>",
|
|
"docstring": "Response returned after successful authentication.\n\nAttributes:\n access_token (str):\n `JWT` access token for authenticated requests.\n user (PublicUser):\n Public profile of the authenticated user.",
|
|
"members": {
|
|
"access_token": {
|
|
"name": "access_token",
|
|
"kind": "attribute",
|
|
"path": "jwtlib.models.app.LoginResponse.access_token",
|
|
"signature": null,
|
|
"docstring": null
|
|
},
|
|
"user": {
|
|
"name": "user",
|
|
"kind": "attribute",
|
|
"path": "jwtlib.models.app.LoginResponse.user",
|
|
"signature": null,
|
|
"docstring": null
|
|
},
|
|
"model_config": {
|
|
"name": "model_config",
|
|
"kind": "attribute",
|
|
"path": "jwtlib.models.app.LoginResponse.model_config",
|
|
"signature": null,
|
|
"docstring": null
|
|
}
|
|
}
|
|
},
|
|
"LogoutResponse": {
|
|
"name": "LogoutResponse",
|
|
"kind": "class",
|
|
"path": "jwtlib.models.app.LogoutResponse",
|
|
"signature": "<bound method Class.signature of Class('LogoutResponse', 157, 174)>",
|
|
"docstring": "Response returned after a logout operation.\n\nAttributes:\n message (str):\n Human-readable logout confirmation.",
|
|
"members": {
|
|
"message": {
|
|
"name": "message",
|
|
"kind": "attribute",
|
|
"path": "jwtlib.models.app.LogoutResponse.message",
|
|
"signature": null,
|
|
"docstring": null
|
|
},
|
|
"model_config": {
|
|
"name": "model_config",
|
|
"kind": "attribute",
|
|
"path": "jwtlib.models.app.LogoutResponse.model_config",
|
|
"signature": null,
|
|
"docstring": null
|
|
}
|
|
}
|
|
},
|
|
"IntrospectResponse": {
|
|
"name": "IntrospectResponse",
|
|
"kind": "class",
|
|
"path": "jwtlib.models.app.IntrospectResponse",
|
|
"signature": "<bound method Class.signature of Class('IntrospectResponse', 177, 233)>",
|
|
"docstring": "Result of a token introspection operation.\n\nAttributes:\n active (bool):\n Indicates whether the token is valid and active.\n user (Optional[PublicUser]):\n Public user details if the token is valid; otherwise null.",
|
|
"members": {
|
|
"active": {
|
|
"name": "active",
|
|
"kind": "attribute",
|
|
"path": "jwtlib.models.app.IntrospectResponse.active",
|
|
"signature": null,
|
|
"docstring": null
|
|
},
|
|
"user": {
|
|
"name": "user",
|
|
"kind": "attribute",
|
|
"path": "jwtlib.models.app.IntrospectResponse.user",
|
|
"signature": null,
|
|
"docstring": null
|
|
},
|
|
"model_config": {
|
|
"name": "model_config",
|
|
"kind": "attribute",
|
|
"path": "jwtlib.models.app.IntrospectResponse.model_config",
|
|
"signature": null,
|
|
"docstring": null
|
|
},
|
|
"jwt_error": {
|
|
"name": "jwt_error",
|
|
"kind": "function",
|
|
"path": "jwtlib.models.app.IntrospectResponse.jwt_error",
|
|
"signature": "<bound method Function.signature of Function('jwt_error', 213, 215)>",
|
|
"docstring": null
|
|
},
|
|
"no_username": {
|
|
"name": "no_username",
|
|
"kind": "function",
|
|
"path": "jwtlib.models.app.IntrospectResponse.no_username",
|
|
"signature": "<bound method Function.signature of Function('no_username', 217, 219)>",
|
|
"docstring": null
|
|
},
|
|
"no_user": {
|
|
"name": "no_user",
|
|
"kind": "function",
|
|
"path": "jwtlib.models.app.IntrospectResponse.no_user",
|
|
"signature": "<bound method Function.signature of Function('no_user', 221, 223)>",
|
|
"docstring": null
|
|
},
|
|
"valid_user": {
|
|
"name": "valid_user",
|
|
"kind": "function",
|
|
"path": "jwtlib.models.app.IntrospectResponse.valid_user",
|
|
"signature": "<bound method Function.signature of Function('valid_user', 225, 233)>",
|
|
"docstring": null
|
|
}
|
|
}
|
|
},
|
|
"Any": {
|
|
"name": "Any",
|
|
"kind": "alias",
|
|
"path": "jwtlib.models.app.Any",
|
|
"signature": "<bound method Alias.signature of Alias('Any', 'typing.Any')>",
|
|
"docstring": null
|
|
}
|
|
}
|
|
},
|
|
"common": {
|
|
"name": "common",
|
|
"kind": "module",
|
|
"path": "jwtlib.models.common",
|
|
"signature": null,
|
|
"docstring": "# Summary\n\nCommon Pydantic mixins for authentication models.\n\nThis module provides reusable mixins for identity, password, and\naccount state. These mixes ensure consistency across internal\npersistence models and public-facing projection models.",
|
|
"members": {
|
|
"BaseModel": {
|
|
"name": "BaseModel",
|
|
"kind": "alias",
|
|
"path": "jwtlib.models.common.BaseModel",
|
|
"signature": "<bound method Alias.signature of Alias('BaseModel', 'pydantic.BaseModel')>",
|
|
"docstring": null
|
|
},
|
|
"EmailStr": {
|
|
"name": "EmailStr",
|
|
"kind": "alias",
|
|
"path": "jwtlib.models.common.EmailStr",
|
|
"signature": "<bound method Alias.signature of Alias('EmailStr', 'pydantic.EmailStr')>",
|
|
"docstring": null
|
|
},
|
|
"Field": {
|
|
"name": "Field",
|
|
"kind": "alias",
|
|
"path": "jwtlib.models.common.Field",
|
|
"signature": "<bound method Alias.signature of Alias('Field', 'pydantic.Field')>",
|
|
"docstring": null
|
|
},
|
|
"IdentityMixin": {
|
|
"name": "IdentityMixin",
|
|
"kind": "class",
|
|
"path": "jwtlib.models.common.IdentityMixin",
|
|
"signature": "<bound method Class.signature of Class('IdentityMixin', 14, 37)>",
|
|
"docstring": "Mixin for entities with a username and email.\n\nAttributes:\n username (str):\n Unique username used for authentication and display.\n email (Optional[EmailStr]):\n Primary email address associated with the account.",
|
|
"members": {
|
|
"username": {
|
|
"name": "username",
|
|
"kind": "attribute",
|
|
"path": "jwtlib.models.common.IdentityMixin.username",
|
|
"signature": null,
|
|
"docstring": null
|
|
},
|
|
"email": {
|
|
"name": "email",
|
|
"kind": "attribute",
|
|
"path": "jwtlib.models.common.IdentityMixin.email",
|
|
"signature": null,
|
|
"docstring": null
|
|
}
|
|
}
|
|
},
|
|
"PasswordMixin": {
|
|
"name": "PasswordMixin",
|
|
"kind": "class",
|
|
"path": "jwtlib.models.common.PasswordMixin",
|
|
"signature": "<bound method Class.signature of Class('PasswordMixin', 40, 54)>",
|
|
"docstring": "Mixin for entities with a raw password field.\n\nAttributes:\n password (str):\n User password (minimum 6 characters).",
|
|
"members": {
|
|
"password": {
|
|
"name": "password",
|
|
"kind": "attribute",
|
|
"path": "jwtlib.models.common.PasswordMixin.password",
|
|
"signature": null,
|
|
"docstring": null
|
|
}
|
|
}
|
|
},
|
|
"ActiveStateMixin": {
|
|
"name": "ActiveStateMixin",
|
|
"kind": "class",
|
|
"path": "jwtlib.models.common.ActiveStateMixin",
|
|
"signature": "<bound method Class.signature of Class('ActiveStateMixin', 57, 71)>",
|
|
"docstring": "Mixin for entities with an active status flag.\n\nAttributes:\n is_active (bool):\n Indicates whether the account is active and allowed to\n authenticate.",
|
|
"members": {
|
|
"is_active": {
|
|
"name": "is_active",
|
|
"kind": "attribute",
|
|
"path": "jwtlib.models.common.ActiveStateMixin.is_active",
|
|
"signature": null,
|
|
"docstring": null
|
|
}
|
|
}
|
|
}
|
|
}
|
|
},
|
|
"mongo": {
|
|
"name": "mongo",
|
|
"kind": "module",
|
|
"path": "jwtlib.models.mongo",
|
|
"signature": null,
|
|
"docstring": "# Summary\n\nPersistence-layer user model for MongoDB.\n\nThis module defines the internal database representation of a user.\nIt is used exclusively by the repository and persistence layers and\nmust never be exposed directly to consumers.\n\nPublic-facing user data is provided via dedicated projection models.",
|
|
"members": {
|
|
"BaseDocument": {
|
|
"name": "BaseDocument",
|
|
"kind": "alias",
|
|
"path": "jwtlib.models.mongo.BaseDocument",
|
|
"signature": "<bound method Alias.signature of Alias('BaseDocument', 'mongo_ops.BaseDocument')>",
|
|
"docstring": null
|
|
},
|
|
"ActiveStateMixin": {
|
|
"name": "ActiveStateMixin",
|
|
"kind": "class",
|
|
"path": "jwtlib.models.mongo.ActiveStateMixin",
|
|
"signature": "<bound method Alias.signature of Alias('ActiveStateMixin', 'jwtlib.models.common.ActiveStateMixin')>",
|
|
"docstring": "Mixin for entities with an active status flag.\n\nAttributes:\n is_active (bool):\n Indicates whether the account is active and allowed to\n authenticate.",
|
|
"members": {
|
|
"is_active": {
|
|
"name": "is_active",
|
|
"kind": "attribute",
|
|
"path": "jwtlib.models.mongo.ActiveStateMixin.is_active",
|
|
"signature": "<bound method Alias.signature of Alias('is_active', 'jwtlib.models.common.ActiveStateMixin.is_active')>",
|
|
"docstring": null
|
|
}
|
|
}
|
|
},
|
|
"IdentityMixin": {
|
|
"name": "IdentityMixin",
|
|
"kind": "class",
|
|
"path": "jwtlib.models.mongo.IdentityMixin",
|
|
"signature": "<bound method Alias.signature of Alias('IdentityMixin', 'jwtlib.models.common.IdentityMixin')>",
|
|
"docstring": "Mixin for entities with a username and email.\n\nAttributes:\n username (str):\n Unique username used for authentication and display.\n email (Optional[EmailStr]):\n Primary email address associated with the account.",
|
|
"members": {
|
|
"username": {
|
|
"name": "username",
|
|
"kind": "attribute",
|
|
"path": "jwtlib.models.mongo.IdentityMixin.username",
|
|
"signature": "<bound method Alias.signature of Alias('username', 'jwtlib.models.common.IdentityMixin.username')>",
|
|
"docstring": null
|
|
},
|
|
"email": {
|
|
"name": "email",
|
|
"kind": "attribute",
|
|
"path": "jwtlib.models.mongo.IdentityMixin.email",
|
|
"signature": "<bound method Alias.signature of Alias('email', 'jwtlib.models.common.IdentityMixin.email')>",
|
|
"docstring": null
|
|
}
|
|
}
|
|
},
|
|
"User": {
|
|
"name": "User",
|
|
"kind": "class",
|
|
"path": "jwtlib.models.mongo.User",
|
|
"signature": "<bound method Class.signature of Class('User', 18, 40)>",
|
|
"docstring": "Internal user persistence model.\n\nAttributes:\n hashed_password (str):\n Secure hash of the user's password.\n\nNotes:\n **Responsibilities:**\n\n - Represents a user record as stored in the database. Includes\n sensitive fields and is strictly confined to the persistence\n layer.\n\n **Guarantees:**\n\n - This model MUST NOT be returned from authentication APIs.\n Consumers should use `PublicUser` instead. Password verification\n is handled by the repository layer.",
|
|
"members": {
|
|
"hashed_password": {
|
|
"name": "hashed_password",
|
|
"kind": "attribute",
|
|
"path": "jwtlib.models.mongo.User.hashed_password",
|
|
"signature": null,
|
|
"docstring": null
|
|
}
|
|
}
|
|
}
|
|
}
|
|
},
|
|
"security": {
|
|
"name": "security",
|
|
"kind": "module",
|
|
"path": "jwtlib.models.security",
|
|
"signature": null,
|
|
"docstring": "# Summary\n\nJWT token payload models.\n\nThis module defines typed representations of decoded `JWT` payloads used\ninternally for token validation and user resolution.",
|
|
"members": {
|
|
"BaseModel": {
|
|
"name": "BaseModel",
|
|
"kind": "alias",
|
|
"path": "jwtlib.models.security.BaseModel",
|
|
"signature": "<bound method Alias.signature of Alias('BaseModel', 'pydantic.BaseModel')>",
|
|
"docstring": null
|
|
},
|
|
"TokenPayload": {
|
|
"name": "TokenPayload",
|
|
"kind": "class",
|
|
"path": "jwtlib.models.security.TokenPayload",
|
|
"signature": "<bound method Class.signature of Class('TokenPayload', 13, 38)>",
|
|
"docstring": "Decoded `JWT` payload.\n\nAttributes:\n sub (str):\n Subject claim identifying the user (typically a username or user ID).\n exp (int):\n Expiration time as a Unix timestamp (seconds since epoch).\n\nNotes:\n **Responsibilities:**\n\n - Represents the validated claims extracted from a `JWT` after\n signature verification. This model is used internally to enforce\n required claims and provide a typed interface to token data.\n\n **Guarantees:**\n\n - This model assumes the `JWT` signature has already been verified.\n No authorization decisions should be made solely on this model.\n Additional claims may exist but are intentionally ignored.",
|
|
"members": {
|
|
"sub": {
|
|
"name": "sub",
|
|
"kind": "attribute",
|
|
"path": "jwtlib.models.security.TokenPayload.sub",
|
|
"signature": null,
|
|
"docstring": null
|
|
},
|
|
"exp": {
|
|
"name": "exp",
|
|
"kind": "attribute",
|
|
"path": "jwtlib.models.security.TokenPayload.exp",
|
|
"signature": null,
|
|
"docstring": null
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
} |