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 an authenticated identity before reaching the controller.

Guests never reach the route handler. Browsers are redirected to the page declared in auth.session.redirect_to when one is configured, and every other client receives a 401 response produced by the standard exception handler.

With no explicit guard, reuse the identity established by the kernel. Outside that pipeline, fall back to the configured default guard.

Responses of protected routes are marked as non-cacheable. Subclasses opt out by setting cache_control to None.

Method __init__ Initialise the middleware with its collaborators.
Method _unauthenticated Build the answer given to an anonymous request.
Async Method handle Reject anonymous requests and continue authenticated ones.
Class Variable __slots__ Declare the instance attribute slots reserved by this class.
Class Variable cache_control Cache-Control applied to every answer of a protected route.
Instance Variable _redirect_to Redirect to produced by app.config.

Inherited from ResolveIdentityMiddleware:

Async Method _establish Resolve the identity and bind the resulting context.
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, app: IApplication, manager: IAuthManager, permissions: IPermissionRepository): (source)

Initialise the middleware with its collaborators.

Parameters
app:orionis.IApplicationApplication exposing the auth.session configuration.
manager:orionis.auth.contracts.IAuthManagerManager exposing the configured guards.
permissions:orionis.auth.contracts.IPermissionRepositorySource the authorization snapshot is built from.
Returns
NoneNo return value.
def _unauthenticated(self, request: Request) -> Response: (source)

Build the answer given to an anonymous request.

Parameters
request:orionis.http.RequestIncoming HTTP request.
Returns
orionis.http.ResponseRedirect to the configured login page.
Raises
orionis.auth.AuthenticationExceptionWhen the client expects a machine readable answer, or no redirect target is configured. The exception is translated into a 401 response by the framework exception handler.
async def handle(self, request: Request, call_next: NextCallable) -> Response: (source)

Reject anonymous requests and continue authenticated ones.

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, or a redirect to the login page for anonymous browser requests.
Raises
orionis.auth.AuthenticationExceptionWhen no identity backs the request and no redirect target is configured for browsers.
cache_control: ClassVar[str | None] = (source)

Cache-Control applied to every answer of a protected route.

_redirect_to: str | None = (source)

Redirect to produced by app.config.