gws.base.auth.throttle¶
Authentication throttle.
Counts failed authentication attempts and blocks further attempts once a limit is reached. Attempts are counted per remote address and, optionally, per login name.
Source code: gws.base.auth.throttle
Module Contents¶
- class gws.base.auth.throttle.Config(*args, **kwargs)¶
Authentication throttle options. (added in 8.4)
- allowFrom: list[str] | None¶
Addresses exempt from throttling.
- blockTime: gws.Duration = '15m'¶
How long to block once the limit is reached.
- maxAttemptsPerIp: int = 10¶
Failed attempts from one address before blocking.
- maxAttemptsPerUser: int = 0¶
Failed attempts for one login from all addresses before blocking, 0=no limit.
- path: str | None¶
Throttle storage path.
- windowTime: gws.Duration = '10m'¶
Time span in which failed attempts are counted.
- class gws.base.auth.throttle.Object¶
Authentication throttle.
- allowFrom: set[str]¶
- blockTime: int¶
- dbPath: str¶
- maxAttemptsPerIp: int¶
- maxAttemptsPerUser: int¶
- table = 'throttle'¶
- windowTime: int¶
- blocked_for(req: gws.WebRequester, method: gws.AuthMethod, credentials: gws.Data) int¶
Return the time in seconds the given attempt remains blocked, 0 if it is allowed.
- cleanup()¶
- configure()¶
Configuration hook.
- register(ok: bool, req: gws.WebRequester, method: gws.AuthMethod, credentials: gws.Data)¶
Register the outcome of an authentication attempt.