Files
docs/mcp/py-jwt/modules/jwtlib.introspection.json
Vishesh 'ironeagle' Bangotra 0c25cbb19f feat: unify docs portal and MCP servers into one config-driven service
- add config.yml as single source of truth for collected repos/categories
- add collect.py CLI to pull lib/api/wiki site builds and mcp bundles from
  source repos and regenerate nginx.conf + _index/index.html
- port mcp runtime (main.py/core.py/config.py): nginx + health + FastMCP
  servers started from config.yml
- docker: python:3.13-slim + nginx, expose 8000-8006 + 9000 (html portal)
- drone: publish html (6007:9000) and MCP ports 8000-8006
- move mongo-ops docs to wiki/, add auth-server (api) and hexa (lib)
- refresh lib site builds (lib/ prefix) and collect mcp bundles
2026-09-11 15:14:51 +05:30

116 lines
7.2 KiB
JSON

{
"module": "jwtlib.introspection",
"content": {
"path": "jwtlib.introspection",
"docstring": "Auth client and access-control utilities.\n\n---\n\n## Summary\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.",
"objects": {
"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', 50, 94)>",
"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', 102, 147)>",
"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`."
}
}
}
}