Skip to content

common_auth.tokens.stored

Read-only custody access and the explicitly capable acquisition owner.

Classes

ManagedTokens

Bases: StoredTokens

Serialize acquisition across owners and durably record uncertain issuance.

The guard commits a pending marker before contacting the issuer. A process crash, cancellation or failed persistence leaves that marker, preventing a second owner from replaying a potentially rotated refresh credential. Client credentials can recover on a subsequent lookup; waiting callers share the preceding uncertain outcome. Refresh/code uncertainty requires explicit publication after operator/provider recovery.

__init__

def __init__(config: ManagedTokenConfig, *, store: BaseStore, grant: Grant) -> None

publish

async def publish(tokens: TokenSet, *, expected_revision: int, acquired_at: datetime | None = None) -> AuthResult[TokenSet]

Publish an explicit, fully assembled snapshot using the observed revision.

refresh

async def refresh() -> AuthResult[AccessToken]

Explicitly request one renewal; rotating credentials cannot be replayed.

StoredTokens

Bases: BaseTokens

Read access tokens from a store; deliberately has no acquisition method.

__init__

def __init__(config: ManagedTokenConfig, *, store: BaseStore, issuer: str | None = None, client_id: str | None = None) -> None