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

Establish authentication while allowing anonymous requests to continue.

The HTTP kernel installs the session variant for web routes and the token variant for API routes. Guests reach the controller with a guest context, and Auth.check() answers False.

An authenticated context cannot be replaced by another guard. Repeated resolution by the same guard reuses the context, including guest results.

Subclasses pin a specific guard by overriding the guard class attribute:

class ResolveApiIdentity(ResolveIdentityMiddleware):
    guard = "token"
Method __init__ Initialise the middleware with its collaborators.
Async Method _establish Resolve the identity and bind the resulting context.
Async Method handle Bind the authentication context and continue the pipeline.
Class Variable __slots__ Declare the instance attribute slots reserved by this class.
Class Variable guard An unpinned middleware reuses the request guard. Before any resolution, None falls back to the configured default guard.
Instance Variable _manager Manager exposing the configured guards.
Instance Variable _permissions Source the authorization snapshot is built from.
def __init__(self, manager: IAuthManager, permissions: IPermissionRepository): (source)

Initialise the middleware with its collaborators.

Parameters
manager:orionis.auth.contracts.IAuthManagerManager exposing the configured guards.
permissions:orionis.auth.contracts.IPermissionRepositorySource the authorization snapshot is built from.
Returns
NoneNo return value.
async def _establish(self, request: Request) -> IAuthenticationContext: (source)

Resolve the identity and bind the resulting context.

The context is stored in the container scope opened by the HTTP kernel, never on this middleware: instances are shared by every concurrent request.

Parameters
request:orionis.http.RequestIncoming HTTP request.
Returns
orionis.auth.contracts.IAuthenticationContextContext bound for the rest of the request.
async def handle(self, request: Request, call_next: NextCallable) -> Response: (source)

Bind the authentication context and continue the pipeline.

Parameters
request:orionis.http.RequestIncoming HTTP request.
call_next:orionis.http.NextCallableCallable advancing to the next layer.
Returns
orionis.http.ResponseResponse produced by the rest of the pipeline.
guard: ClassVar[str | None] = (source)

An unpinned middleware reuses the request guard. Before any resolution, None falls back to the configured default guard.

_manager = (source)

Manager exposing the configured guards.

_permissions = (source)

Source the authorization snapshot is built from.