Authorization
rn_forge.auth.authorization
Authenticator and authorizer contracts.
Missing or invalid credentials produce a 401 challenge; an authenticated principal without sufficient access produces 403. Verification details must not be exposed in the 401 response.
AsyncAuthenticator
Bases: Protocol
Asynchronous counterpart of :class:Authenticator.
authenticate(*, credentials)
async
See :meth:Authenticator.authenticate.
Authenticator
Bases: Protocol
Turns raw credentials into a verified :class:Principal.
authenticate(*, credentials)
Verify credentials.
Raises:
| Type | Description |
|---|---|
AuthenticationFailed
|
The credentials are absent, malformed or invalid. The message must not say which. |
Authorizer
Bases: Protocol
Decides whether a verified principal may proceed.
authorize(principal, *, requires)
Permit the request, or refuse it.
Raises:
| Type | Description |
|---|---|
PermissionDenied
|
The principal lacks the required access. Never
:class: |
ScopeAuthorizer(*, log=None)
An :class:Authorizer that evaluates a :class:Requirement.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
log
|
Callable[[str, Mapping[str, Any]], None] | None
|
Optional sink called as |
None
|
authorize(principal, *, requires)
See :meth:Authorizer.authorize.