Factor base
reauth.factors.base
FactorEnrollment
Bases: Protocol
Protocol for factor enrollment objects, which represent the state of an enrolled factor for a given identity.
id
instance-attribute
id: Any | None
identity_id
instance-attribute
identity_id: Any
FactorBase
FactorBase(
*, identifier: str, step: int = 0, advance_by: int = 1
)
Bases: ABC
Base abstract class for all factor services.
Initialize the factor base.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
identifier
|
str
|
A unique identifier for the factor, used for logging and API purposes. |
required |
step
|
int
|
The authentication step at which this factor can be used. Factors are only available when the session's current step matches this value. Defaults to 0 (can be first factor). |
0
|
advance_by
|
int
|
The number of steps to advance the authentication session after this factor is successfully verified. Defaults to 1. |
1
|
Raises:
| Type | Description |
|---|---|
ValueError
|
If advance_by is less than 1. |
AMR
class-attribute
AMR: AuthenticationMethodReference
identifier
instance-attribute
identifier = identifier
step
instance-attribute
step = step
advance_by
instance-attribute
advance_by = advance_by
get_enrollment
abstractmethod
async
get_enrollment(identity_id: Any) -> ENROLLMENT | None
Get the enrollment information for a given identity.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
identity_id
|
Any
|
The ID of the identity to get the factor configuration for. |
required |
Returns:
| Type | Description |
|---|---|
ENROLLMENT | None
|
The enrollment information for the factor, |
ENROLLMENT | None
|
or None if the factor is not enrolled for the identity. |