Skip to content

Authorization context

rn_forge.auth.context

Authorization context contract.

AuthorizationContext(active, session_version, permissions=frozenset(), roles=frozenset(), attributes=dict[str, Any]()) dataclass

An account's current authorization data.

Attributes:

Name Type Description
active bool

Whether the account may authenticate.

session_version int

The account's current session version.

permissions frozenset[str]

Permission keys the account holds.

roles frozenset[str]

Role names, as a display hint and provider input.

attributes Mapping[str, Any]

Inputs to attribute-based rules, such as tenant, org units and locations.

AuthorizationContextProvider

Bases: Protocol

Supplies the :class:AuthorizationContext of an account.

resolve(account_id)

Return the current context of account_id.