Skip to content

Accounts

rn_forge.auth.accounts

Account resolution contract.

AccountRejected(reason)

Bases: AppException

A login was refused by the :class:AccountResolver.

The reason is for logs and is never shown to the user.

Parameters:

Name Type Description Default
reason str

A short description of why the login was refused.

required

check(value, message, *message_args, **kwargs) classmethod

Raise this exception if value is falsy.

Parameters:

Name Type Description Default
value Any

The value to test.

required
message str

Exception message (supports positional format args).

required
*message_args Any

Forwarded to message.format().

()
**kwargs Any

Forwarded as error_code / error_data to the constructor.

{}

Example::

AppException.check(path.exists(), "Missing file: {}", path, error_code=404)

AccountResolver

Bases: Protocol

Maps an external identity to an internal account.

lookup(issuer, subject)

Return the account ID linked to issuer and subject, if any.

Never provisions.

resolve(identity)

Link, provision or reject a login, and return the account ID.

Raises:

Type Description
AccountRejected

The login may not proceed.