Classes
LockoutBackend
3
▼
Protocol for lockout storage backends.
LockoutBackend
3
▼
Protocol for lockout storage backends.
Methods
is_locked
1
tuple[bool, int]
▼
Return (is_locked, retry_after_seconds).
is_locked
1
tuple[bool, int]
▼
def is_locked(self, key: str) -> tuple[bool, int]
Parameters
| Name | Type | Description |
|---|---|---|
key |
— |
Returns
tuple[bool, int]
record_success
1
▼
Clear failure state after successful auth.
record_success
1
▼
def record_success(self, key: str) -> None
Parameters
| Name | Type | Description |
|---|---|---|
key |
— |
record_failure
1
tuple[bool, int]
▼
Record failure and return (is_locked, retry_after_seconds).
record_failure
1
tuple[bool, int]
▼
def record_failure(self, key: str) -> tuple[bool, int]
Parameters
| Name | Type | Description |
|---|---|---|
key |
— |
Returns
tuple[bool, int]
LockoutConfig
6
▼
Lockout policy configuration.
LockoutConfig
6
▼
Lockout policy configuration.
Attributes
| Name | Type | Description |
|---|---|---|
max_failures |
int
|
— |
window_seconds |
int
|
— |
base_lock_seconds |
int
|
— |
backoff_multiplier |
float
|
— |
max_lock_seconds |
int
|
— |
backend |
LockoutBackend | None
|
— |
_InMemoryLockoutBackend
4
▼
In-memory lockout backend.
_InMemoryLockoutBackend
4
▼
In-memory lockout backend.
Methods
is_locked
1
tuple[bool, int]
▼
is_locked
1
tuple[bool, int]
▼
def is_locked(self, key: str) -> tuple[bool, int]
Parameters
| Name | Type | Description |
|---|---|---|
key |
— |
Returns
tuple[bool, int]
record_success
1
▼
record_success
1
▼
def record_success(self, key: str) -> None
Parameters
| Name | Type | Description |
|---|---|---|
key |
— |
record_failure
1
tuple[bool, int]
▼
record_failure
1
tuple[bool, int]
▼
def record_failure(self, key: str) -> tuple[bool, int]
Parameters
| Name | Type | Description |
|---|---|---|
key |
— |
Returns
tuple[bool, int]
Internal Methods 1 ▼
__init__
1
▼
__init__
1
▼
def __init__(self, config: LockoutConfig) -> None
Parameters
| Name | Type | Description |
|---|---|---|
config |
— |
LoginLockout
4
▼
Track login failures and compute lockout windows.
LoginLockout
4
▼
Track login failures and compute lockout windows.
Methods
is_locked
1
tuple[bool, int]
▼
Return lock status and retry-after seconds.
is_locked
1
tuple[bool, int]
▼
def is_locked(self, key: str) -> tuple[bool, int]
Parameters
| Name | Type | Description |
|---|---|---|
key |
— |
Returns
tuple[bool, int]
record_success
1
▼
Clear failure state after successful authentication.
record_success
1
▼
def record_success(self, key: str) -> None
Parameters
| Name | Type | Description |
|---|---|---|
key |
— |
record_failure
1
tuple[bool, int]
▼
Record a failed attempt and return lock status.
Returns ``(is_locked, retry_af…
record_failure
1
tuple[bool, int]
▼
def record_failure(self, key: str) -> tuple[bool, int]
Record a failed attempt and return lock status.
Returns(is_locked, retry_after_seconds).
Parameters
| Name | Type | Description |
|---|---|---|
key |
— |
Returns
tuple[bool, int]
Internal Methods 1 ▼
__init__
1
▼
__init__
1
▼
def __init__(self, config: LockoutConfig | None = None) -> None
Parameters
| Name | Type | Description |
|---|---|---|
config |
— |
Default:None
|