thunderbird_accounts.authentication.clients
Classes
|
|
Client for self-service, realm-scoped Keycloak calls made as the end user. |
|
|
|
- class thunderbird_accounts.authentication.clients.KeycloakMfaClient[source]
Bases:
objectClient for self-service, realm-scoped Keycloak calls made as the end user.
These use the end user’s forwarded OIDC access token and operate on the token subject: the keycloak-mfa-rest provider (/realms/{realm}/mfa/) plus Keycloak’s built-in Account REST API (/realms/{realm}/account/). Keep this separate from the admin API client so the two trust boundaries cannot accidentally share auth or endpoint routing.
- start_totp_setup(user_access_token: str) TotpSetupResponse[source]
Generate a TOTP secret + otpauth URI for the calling user without writing it.
- register_totp_credential(user_access_token: str, secret: str, code: str, user_label: str) dict[source]
Verify
codeagainstsecretand register an enrollment-only TOTP credential.
- regenerate_recovery_codes(user_access_token: str, user_label: str | None = None) RecoveryCodesResponse[source]
Replace recovery codes for the calling user and return the plaintext codes once.
- logout_other_sessions(user_access_token: str) bool[source]
Sign the user out of all sessions except the one this token belongs to.
Uses Keycloak’s built-in Account REST API (realm-scoped, self-service), whose DELETE account/sessions preserves the calling session — unlike the admin user-logout, which is logout-all and would evict the current session too (#1005).