Skip to main content

Module state

Module state 

Source
Expand description

OAuth 2.1 server state management.

Manages registered clients, pending authorization codes, refresh tokens, and delegates token issuance to PolicyService via ZMQ.

Structs§

AuthorizeBinding
Server-side state stashed between authorize_get and authorize_post, keyed by the consent nonce. Carries the complete resolved authorization request so hidden form fields never become mutable authority on POST.
OAuthState
Shared OAuth server state.
PendingAuthCode
A pending authorization code awaiting token exchange.
PendingDeviceCode
A pending device authorization code (RFC 8628).
PendingExternalAuth
Pending external OIDC authentication flow.
PendingFederateOwnerLink
PublicGitCanaryRecord
PushedAuthRequest
A Pushed Authorization Request (RFC 9126) awaiting consumption.
RefreshTokenEntry
A stored refresh token entry (OAuth 2.1 rotation).
RegisteredClient
A dynamically registered OAuth client (RFC 7591) or Client ID Metadata Document client.
UcanGrantRefresh
Re-evaluation context persisted alongside a UCAN-grant refresh token so the refresh path can re-present the grant to evaluate_refresh (MAC #547 / B1 #673). Carrying the grant itself (not just an id) lets the gate chain re-check the ceiling against current state on every refresh.

Enums§

DeviceCodeStatus
Status of a pending device authorization code (RFC 8628).
ScopeError
Errors raised by validate_requested_scopes.
SubjectDidError
Errors raised by subject_did_for / OAuthState::subject_did.

Constants§

ATPROTO_SCOPE
The atproto transition scope name. Its presence in a granted scope set activates the strict atproto OAuth profile (#1113 rev2): DPoP-mandatory, DID subject, token_type: DPoP response, scope enforcement.

Traits§

AtprotoDidDocumentResolver
Read-only resolver used by the ATProto service-auth exchange perimeter.

Functions§

atproto_profile_active
True when the granted scope set activates the atproto strict profile.
canonical_issuer_origin
Canonicalize an issuer/external URL to an exact origin (scheme://host[:port]) with no trailing slash and no path (#1113 rev2 finding 5). Returns None when the URL has no scheme or authority.
evaluate_atproto_eligibility
Evaluate atproto account eligibility from the account’s stored keys and profile (#1113 r5 / #1124 split). Free-function form so it is unit-testable without constructing an OAuthState or UserStore.
normalize_scope_token
Normalize a single scope token. RFC 6749 §3.3 scope tokens are 1*(%x21 / %x23-5B / %x5D-7E) — no space, no ", no control chars. Returns None for tokens that are empty or contain characters outside the allowed set.
subject_did_for
Validate that a subject is a real, resolvable atproto account DID (#1113 rev2 → #1124 split).
validate_requested_scopes
Validate a requested scope set against the server-supported and (optionally) client-declared scopes (#1113 rev2 finding 4).