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 ResolveIdentityMiddleware(BaseMiddleware): (source)
Known subclasses: orionis.auth.middleware.AuthenticateMiddleware, orionis.auth.middleware.GuestMiddleware, orionis.auth.middleware.ResolveSessionIdentityMiddleware, orionis.auth.middleware.ResolveTokenIdentityMiddleware
Constructor: ResolveIdentityMiddleware(manager, permissions)
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. |
orionis.auth.middleware.AuthenticateMiddleware, orionis.auth.middleware.GuestMiddlewareInitialise the middleware with its collaborators.
| Parameters | |
manager:orionis.auth.contracts.IAuthManager | Manager exposing the configured guards. |
permissions:orionis.auth.contracts.IPermissionRepository | Source the authorization snapshot is built from. |
| Returns | |
None | No return value. |
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.Request | Incoming HTTP request. |
| Returns | |
orionis.auth.contracts.IAuthenticationContext | Context bound for the rest of the request. |
orionis.http.BaseMiddleware.handleorionis.auth.middleware.AuthenticateMiddleware, orionis.auth.middleware.GuestMiddleware, orionis.auth.middleware.ResolveSessionIdentityMiddlewareBind the authentication context and continue the pipeline.
| Parameters | |
request:orionis.http.Request | Incoming HTTP request. |
callorionis.http.NextCallable | Callable advancing to the next layer. |
| Returns | |
orionis.http.Response | Response produced by the rest of the pipeline. |
orionis.http.BaseMiddleware.__slots__orionis.auth.middleware.AuthenticateMiddleware, orionis.auth.middleware.GuestMiddleware, orionis.auth.middleware.ResolveSessionIdentityMiddleware, orionis.auth.middleware.ResolveTokenIdentityMiddlewareDeclare the instance attribute slots reserved by this class.