ORIONIS API REFERENCE

THE ORIONIS API

Build with clarity.

Explore the building blocks of an async-first Python framework. Every module, class, and method — connected, searchable, and ready to build with.

class documentation

Require one or more roles before reaching the controller.

Roles are a grouping of permissions, so prefer RequirePermissionMiddleware whenever the route protects a concrete capability. Declare the requirement by subclassing:

class MustBeAdmin(RequireRoleMiddleware):
    roles = ("admin",)
Async Method __evaluate Report whether the context satisfies the role requirement.
Method __init__ Initialise the middleware with the authorizer.
Async Method handle Evaluate the roles and continue when they are granted.
Class Variable __slots__ Undocumented
Class Variable requires_all Undocumented
Class Variable roles Undocumented
Instance Variable _authorizer Undocumented
async def __evaluate(self, context: object, required: tuple[str, ...]) -> bool: (source)

Report whether the context satisfies the role requirement.

Parameters
context:objectAuthentication context of the current request.
required:tuple[str, ...]Roles declared by the subclass.
Returns
boolTrue when the requirement is satisfied.
def __init__(self, authorizer: IAuthorizer): (source)

Initialise the middleware with the authorizer.

Parameters
authorizer:IAuthorizerComponent evaluating the roles of the request context.
Returns
NoneThe middleware keeps no per request state.
async def handle(self, request: Request, call_next: NextCallable) -> Response: (source)

Evaluate the roles and continue when they are granted.

Parameters
request:RequestIncoming HTTP request, unused by this middleware.
call_next:NextCallableCallable advancing to the next layer.
Returns
ResponseResponse produced by the rest of the pipeline.
Raises
AuthConfigurationExceptionWhen the subclass declares no role at all.
AuthenticationExceptionWhen the request carries no authenticated identity.
AuthorizationExceptionWhen the identity does not hold the required roles.
__slots__: tuple[str, ...] = (source)

Undocumented

requires_all: ClassVar[bool] = (source)

Undocumented

roles: ClassVar[tuple[str, ...]] = (source)

Undocumented

_authorizer = (source)

Undocumented