JWT¶
Verify OIDC tokens issued by Auths bridge servers.
AuthsClaims
dataclass
¶
AuthsClaims(sub: str, keri_prefix: str, capabilities: list[str], iss: str, aud: str, exp: int, iat: int, jti: str, signer_type: str | None = None, delegated_by: str | None = None, witness_quorum: dict | None = None, github_actor: str | None = None, github_repository: str | None = None)
Validated claims from an Auths OIDC token.
signer_type
class-attribute
instance-attribute
¶
Signer classification: "Human", "Agent", or "Workload".
delegated_by
class-attribute
instance-attribute
¶
DID of the delegating identity, if this is a delegated token.
witness_quorum
class-attribute
instance-attribute
¶
Witness quorum metadata, if witness-backed.
github_actor
class-attribute
instance-attribute
¶
GitHub username, present for GitHub Actions OIDC tokens.
github_repository
class-attribute
instance-attribute
¶
GitHub repository (owner/repo), present for GitHub Actions OIDC tokens.
has_any_capability
¶
Check if token grants any of the listed capabilities.
has_all_capabilities
¶
Check if token grants all of the listed capabilities.
AuthsJWKSClient
¶
JWKS client with automatic key caching for Auths OIDC token validation.
Parameters:
-
jwks_url(str) –The OIDC bridge's JWKS endpoint.
-
cache_ttl(int, default:300) –How long to cache JWKS keys, in seconds (default: 300).
Examples:
jwks = AuthsJWKSClient("https://bridge.example.com/.well-known/jwks.json")
claims = jwks.verify_token(token, audience="my-service")
verify_token
¶
verify_token(token: str, *, audience: str, issuer: str | None = None, leeway: int = 60) -> AuthsClaims
Verify an Auths OIDC token and extract claims.
Parameters:
-
token(str) –Raw JWT bearer token string.
-
audience(str) –Expected audience claim.
-
issuer(str | None, default:None) –Expected issuer claim (optional, verified if set).
-
leeway(int, default:60) –Clock skew tolerance in seconds (default: 60).
Returns:
-
AuthsClaims–AuthsClaims with the validated token claims.
Raises:
-
VerificationError–If the token is expired, has wrong audience/issuer, or invalid signature.
-
NetworkError–If JWKS keys cannot be fetched.
Examples:
verify_token
¶
verify_token(token: str, *, jwks_url: str, audience: str, issuer: str | None = None, leeway: int = 60) -> AuthsClaims
Verify an Auths OIDC token (one-shot, no JWKS caching).
For production use, prefer AuthsJWKSClient which caches JWKS keys.
Parameters:
-
token(str) –Raw JWT bearer token string.
-
jwks_url(str) –URL to fetch JSON Web Key Set.
-
audience(str) –Expected audience claim.
-
issuer(str | None, default:None) –Expected issuer claim (optional).
-
leeway(int, default:60) –Clock skew tolerance in seconds (default: 60).
Returns:
-
AuthsClaims–AuthsClaims with the validated token claims.
Raises:
-
VerificationError–If the token is invalid.
-
NetworkError–If JWKS keys cannot be fetched.
Examples: