Skip to content

common_auth.schemas.sessions.configs

Provider-session, OAuth login and TOTP settings; construction performs no I/O.

Classes

SessionConfig

Bases: _SessionConfig

Operation and observation policy for injected provider-session hooks.

A connection identifies the integration; actual session IDs are operation values. operation_timeout_sec bounds a hook call, not a user’s whole login. health_cache_ttl_sec=0 requires a fresh observation. Cached observations retain their original timestamp and never outlive known session expiry. Session usability cannot be inferred from bearer-token validity alone. Scheduling and provider-specific start/check/close behavior stay outside configuration. No connection or background activity starts here.

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

connection

connection: ConnectionRef

health_cache_ttl_sec

health_cache_ttl_sec: float = Field(default=0.0, ge=0, allow_inf_nan=False)

operation_timeout_sec

operation_timeout_sec: float | None = Field(default=30.0, gt=0, allow_inf_nan=False)

TotpConfig

Bases: _SessionConfig

TOTP generation parameters for an injected time-based-code utility.

A seed is supplied as protected Base32 text, optionally padded and in either case, or as a source reference. Supplied seeds are checked without rewriting them; resolved seeds need the same validation at runtime. Code generation, time selection and any verification replay/rate controls are runtime duties. Defaults match the existing six-digit, 30-second SHA-1 consumer pattern.

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

algorithm

algorithm: Literal['sha1', 'sha256', 'sha512'] = 'sha1'

credential

credential: CredentialConfig = Field(repr=False)

digits

digits: int = Field(default=6, ge=6, le=8)

period_sec

period_sec: int = Field(default=30, gt=0)