thunderbird_accounts.authentication.utils

Functions

can_register_with_username(username)

Can a user register with this username.

create_aia_url(action)

Create a url for a user to start a keycloak flow.

create_login_hint_url(login_hint)

Create an authorization URL that prefills the username on Keycloak's login page.

delete_user_data(user)

Delete a user from Keycloak, Stalwart, and the local DB.

get_user_by_contact_email(email)

Return a user whose recovery email or account email matches the given address.

is_email_in_allow_list(email)

If USE_ALLOW_LIST is enabled check the email for an existing User or an AllowListEntry.

is_email_reserved(email)

Classes

KeycloakRequiredAction(*values)

Required actions, they're defined in the server's provider info.

class thunderbird_accounts.authentication.utils.KeycloakRequiredAction(*values)[source]

Bases: StrEnum

Required actions, they’re defined in the server’s provider info.

Yes these are case sensitive… CONFIGURE_TOTP webauthn-register-passwordless UPDATE_PASSWORD TERMS_AND_CONDITIONS update_user_locale idp_link VERIFY_EMAIL delete_account webauthn-register VERIFY_PROFILE delete_credential CONFIGURE_RECOVERY_AUTHN_CODES UPDATE_PROFILE

thunderbird_accounts.authentication.utils.is_email_in_allow_list(email: str) bool[source]

If USE_ALLOW_LIST is enabled check the email for an existing User or an AllowListEntry.

thunderbird_accounts.authentication.utils.get_user_by_contact_email(email: str)[source]

Return a user whose recovery email or account email matches the given address.

thunderbird_accounts.authentication.utils.can_register_with_username(username: str)[source]

Can a user register with this username. This checks primary username and any mirrored aliases for our allowed domains

This does not check is_email_reserved, as we generally use a different error for that check.

thunderbird_accounts.authentication.utils.create_aia_url(action: KeycloakRequiredAction)[source]

Create a url for a user to start a keycloak flow. These flows are defined as actions in KeycloakRequiredAction.

thunderbird_accounts.authentication.utils.create_login_hint_url(login_hint: str)[source]

Create an authorization URL that prefills the username on Keycloak’s login page.

thunderbird_accounts.authentication.utils.delete_user_data(user) list[str][source]

Delete a user from Keycloak, Stalwart, and the local DB.

Returns a list of error messages (empty on full success). Errors from external services are captured but do not prevent the local DB deletion from proceeding.