Skip to content

common_auth.schemas.grants.configs

OAuth token acquisition and token-endpoint client-authentication settings.

Classes

ClientSecretClientConfig

Bases: _GrantConfig

Authenticate using one client secret in HTTP Basic or token-request form fields.

Basic here uses OAuth’s form-encoding rules before Base64; it is not the resource authenticator’s raw username/password encoding. References are resolved and checked for client-ID agreement by the later runtime.

Fields and properties declared here; inherited members belong to the bases above.

client_id

client_id: ClientId

credential

credential: CredentialConfig = Field(repr=False)

method

method: Literal[OAuthClientAuthMethod.CLIENT_SECRET_BASIC, OAuthClientAuthMethod.CLIENT_SECRET_POST] = OAuthClientAuthMethod.CLIENT_SECRET_BASIC

GrantConfig

Bases: _GrantConfig

One OAuth grant’s acquisition settings, using a dedicated common-http client.

Codes, PKCE verifiers and refresh tokens are operation inputs, not settings. None scopes leaves the parameter omitted; authorization-code scope selection belongs to the authorization session. Refresh scope narrowing must also be checked against the actual grant at runtime.

HTTP owns execution settings (retries default off). A runtime must not retry code/refresh exchanges with unknown outcomes simply because retries were configured. Resource-request authenticators are never applied here.

refresh_lifetime_field names the token-response member that states a new refresh token’s lifetime in seconds. OAuth leaves it unstandardized; issuers spell it differently (Intuit: x_refresh_token_expires_in). Absent from a response, the refresh token’s expiry stays unknown.

Fields and properties declared here; inherited members belong to the bases above.

client

client: OAuthClientConfig

grant_type

grant_type: OAuthGrantType = Field(strict=False)

http

http: HttpClientConfig = Field(default_factory=HttpClientConfig, repr=False)

issuer

issuer: IssuerId

refresh_lifetime_field

refresh_lifetime_field: str = Field(default='refresh_token_expires_in', pattern='^[A-Za-z][A-Za-z0-9_.-]*$')

scopes

scopes: ScopeSet | None = None

token_url

token_url: URL = Field(repr=False)

merge

def merge(**overrides: object) -> Self

Patch HTTP settings through their own merge; replace other nested values.

PrivateKeyJwtClientConfig

Bases: _GrantConfig

Authenticate with an asymmetric client assertion and explicit expected audience.

Key loading, signing, exp/iat/jti generation and protocol rendering happen in the runtime. Audience is not inferred from the token endpoint URL.

Fields and properties declared here; inherited members belong to the bases above.

algorithm

algorithm: Literal[SignatureAlgorithm.RSA_PKCS1V15_SHA256, SignatureAlgorithm.ECDSA_P256_SHA256, SignatureAlgorithm.ED25519]

assertion_lifetime_sec

assertion_lifetime_sec: float = Field(default=120.0, gt=0, allow_inf_nan=False)

audience

audience: Audience

client_id

client_id: ClientId

credential

credential: CredentialConfig = Field(repr=False)

key_id

key_id: KeyId | None = None

method

method: Literal[OAuthClientAuthMethod.PRIVATE_KEY_JWT] = OAuthClientAuthMethod.PRIVATE_KEY_JWT

PublicClientConfig

Bases: _GrantConfig

An OAuth application without token-endpoint client authentication.

Fields and properties declared here; inherited members belong to the bases above.

client_id

client_id: ClientId

method

method: Literal[OAuthClientAuthMethod.NONE] = OAuthClientAuthMethod.NONE