Skip to main content
The accounts provider contract: user accounts, login flows, sessions.

AccountsAdminServices

tai42_contract.accounts.provider.AccountsAdminServices
Application-side policy services an accounts provider may invoke. Implemented by the application and INJECTED via AccountsProviderSettings.admin — accounts plugins never import the application package, so this Protocol is the only way plugin code can apply a role template, remove a principal’s policy, or flip the disabled marker. Every method mutates application-owned policy state; the plugin never touches that state directly.

Members

apply_role

tai42_contract.accounts.provider.AccountsAdminServices.apply_role
Copy the named role template into the user’s enforced policy. Parameters

remove_policy

tai42_contract.accounts.provider.AccountsAdminServices.remove_policy
Delete the user’s enforced policy (and revoke keys it owned). Parameters

set_user_disabled

tai42_contract.accounts.provider.AccountsAdminServices.set_user_disabled
Set/clear the disabled marker on the user’s enforced policy. Parameters

AccountsProvider

tai42_contract.accounts.provider.AccountsProvider
A user-accounts provider: login methods plus session-token validation. An accounts provider owns human accounts and the login flows that mint session tokens for them. It IS an identity provider: the session tokens it mints are validated through the inherited validate_token — the same seam every credential passes through — so installing an accounts provider never adds a second enforcement pathway. Session tokens are opaque strings minted and stored by the provider (recommended prefix tai-sess- to distinguish them from sk- API keys at a glance); the contract never parses token contents. Storage, hashing, and lifetime are provider-owned. Login/lifecycle HTTP routes (submit endpoints, redirect flows) are shipped by the provider plugin as ordinary router modules; the contract carries only the metadata that lets a generic login screen render them.

Members

login_methods

tai42_contract.accounts.provider.AccountsProvider.login_methods
Declare the login methods this provider offers. Called by the application’s public login-methods aggregator. Must be cheap and side-effect free: this is static, config-derived metadata, not I/O (sync by contract, like readiness_targets).

needs_bootstrap

tai42_contract.accounts.provider.AccountsProvider.needs_bootstrap
Whether this provider still needs its first account created. A LIVE store read (async by contract): the aggregator calls it on every methods fetch so the owner-creation screen disappears the moment the owner exists. Providers with no bootstrap concept return False.

revoke_session

tai42_contract.accounts.provider.AccountsProvider.revoke_session
Revoke the session behind token if it is this provider’s. Returns True when a session was found and revoked; False when the token is not this provider’s (wrong prefix, unknown). The application’s single logout route dispatches across ALL registered accounts providers, so implementations must answer False for foreign tokens instead of raising. Backend errors still raise (fail closed). Parameters

AccountsProviderSettings

tai42_contract.accounts.provider.AccountsProviderSettings
Settings shape handed to an accounts-provider factory. redis and admin are typed loosely for the same reason IdentityProviderSettings.redis is Any: the contract cannot name application or kit types. admin carries the application’s AccountsAdminServices implementation. Attributes

ButtonMethod

tai42_contract.accounts.models.ButtonMethod
A redirect button: the renderer draws a button that navigates to href (e.g. an OIDC authorize route). Attributes

FormField

tai42_contract.accounts.models.FormField
One input of a form-shaped login method. Attributes

FormMethod

tai42_contract.accounts.models.FormMethod
A credentials form: the renderer draws the fields and POSTs them as JSON to submit_path. Attributes

LoginMethod

tai42_contract.accounts.models.LoginMethod
The closed union of renderable login-method shapes.

get_accounts_provider_factory

tai42_contract.accounts.registry.get_accounts_provider_factory
Return the factory registered under name; unknown names raise KeyError. Parameters

iter_accounts_provider_factories

tai42_contract.accounts.registry.iter_accounts_provider_factories
Name-sorted snapshot of all registered factories. Returns a new list: callers may iterate freely without touching registry state. Sorted for deterministic aggregator output.

register_accounts_provider

tai42_contract.accounts.registry.register_accounts_provider
Register a named accounts-provider factory in BOTH registries. Registers factory here and — because an accounts provider is the identity answerer for its own session tokens — into the identity registry under the same name. A duplicate in either registry raises. Parameters

reset_registry

tai42_contract.accounts.registry.reset_registry
Clear the accounts registrations (application start() re-imports plugin modules). Clears only this registry: the application’s start() resets the identity registry itself before re-importing plugin modules.