Authentication¶
The following section documents everything related to authentication.
PartialAccount¶
MFATicket¶
WebPushSubscription¶
PartialSession¶
- class stoat.PartialSession(*, state, id, name)[source]¶
Represents a partial Stoat authentication session.
This inherits from
Base.- await edit(*, http_overrides=None, friendly_name=UNDEFINED)[source]¶
This function is a coroutine.
Edits the session.
- Parameters:
friendly_name (UndefinedOr[
str]) – The new user-friendly client name.- Raises:
Unauthorized– Possible values fortype:Value
Reason
InvalidSessionOne of these:
The current user token is invalid.
The session you tried to edit didn’t belong to your account.
NotFound– Possible values fortype:Value
Reason
UnknownUserThe session was not found.
InternalServerError– Possible values fortype:
- Returns:
The newly updated session.
- Return type:
- await revoke(*, http_overrides=None)[source]¶
This function is a coroutine.
Deletes the session.
Fires
SessionDeleteEventfor the provided session.- Parameters:
http_overrides (Optional[
HTTPOverrideOptions]) – The HTTP request overrides.- Raises:
Unauthorized– Possible values fortype:Value
Reason
InvalidSessionThe current user token is invalid.
InvalidTokenThe provided session did not belong to your account.
NotFound– Possible values fortype:Value
Reason
UnknownUserThe provided session was not found.
InternalServerError– Possible values fortype:
Session¶
- class stoat.Session(*, state, id, name, user_id, token, internal_last_seen, origin, subscription)[source]¶
Represents a Stoat authentication session.
This inherits from
PartialSession.- internal_last_seen¶
When the session was seen last time. If
None, defaults tocreated_at.Added in version 1.2.
- Type:
Optional[
datetime]
- subscription¶
The Web Push subscription associated with this session.
- Type:
Optional[
WebPushSubscription]
MFARequired¶
- async use_recovery_code
- async use_totp
- class stoat.MFARequired(*, ticket, allowed_methods, state, friendly_name)[source]¶
The password is valid, but MFA is required.
- await use_recovery_code(code, *, http_overrides=None, friendly_name=UNDEFINED)[source]¶
This function is a coroutine.
Complete MFA login flow.
- Parameters:
code (
str) – The valid recovery code.http_overrides (Optional[
HTTPOverrideOptions]) – The HTTP request overrides.friendly_name (UndefinedOr[Optional[
str]]) – The user-friendly client name. If set toUNDEFINED, this defaults tofriendly_name.
- Raises:
HTTPException– Possible values fortype:Value
Reason
DisallowedMFAMethodYou tried to use disallowed MFA verification method.
Unauthorized– Possible values fortype:Value
Reason
InvalidTokenThe provided recovery code is invalid.
Forbidden– Possible values fortype:Value
Reason
LockedOutThe account was locked out.
UnverifiedAccountThe account you tried to log into is currently unverified.
InternalServerError– Possible values fortype:
- Returns:
The session if successfully logged in, or
AccountDisabledcontaining user ID associated with the account.- Return type:
Union[
Session,AccountDisabled]
- await use_totp(code, *, http_overrides=None, friendly_name=UNDEFINED)[source]¶
This function is a coroutine.
Complete MFA login flow.
- Parameters:
code (
str) – The valid TOTP code.http_overrides (Optional[
HTTPOverrideOptions]) – The HTTP request overrides.friendly_name (UndefinedOr[Optional[
str]]) – The user-friendly client name. If set toUNDEFINED, this defaults tofriendly_name.
- Raises:
HTTPException– Possible values fortype:Value
Reason
DisallowedMFAMethodYou tried to use disallowed MFA verification method.
Unauthorized– Possible values fortype:Value
Reason
InvalidTokenThe provided TOTP code is invalid.
Forbidden– Possible values fortype:Value
Reason
LockedOutThe account was locked out.
UnverifiedAccountThe account you tried to log into is currently unverified.
InternalServerError– Possible values fortype:
- Returns:
The session if successfully logged in, or
AccountDisabledcontaining user ID associated with the account.- Return type:
Union[
Session,AccountDisabled]
AccountDisabled¶
MFAStatus¶
BaseMFAResponse¶
ByPassword¶
- class stoat.ByPassword(password)[source]¶
Represents MFA verification by password.
This inherits from
BaseMFAResponse.
ByRecoveryCode¶
- class stoat.ByRecoveryCode(code, /)[source]¶
Represents MFA verification by recovery code.
This inherits from
BaseMFAResponse.
ByTOTP¶
- class stoat.ByTOTP(code, /)[source]¶
Represents MFA verification by TOTP code.
This inherits from
BaseMFAResponse.
MFAResponse¶
- class stoat.MFAResponse¶
An union of all possible MFA verification responses.
The following classes are included in this union:
LoginResult¶
- class stoat.LoginResult¶
An union of all login responses.
The following classes are included in this union: