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__ |
Undocumented |
| Class Variable | guard |
Undocumented |
| Instance Variable | _manager |
Undocumented |
| Instance Variable | _permissions |
Undocumented |
orionis.auth.middleware.AuthenticateMiddleware, orionis.auth.middleware.GuestMiddlewareInitialise the middleware with its collaborators.
| Parameters | |
manager:IAuthManager | Manager exposing the configured guards. |
permissions:IPermissionRepository | Source the authorization snapshot is built from. |
| Returns | |
None | Middleware instances are built once at boot and stay stateless afterwards. |
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:Request | Incoming HTTP request. |
| Returns | |
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:Request | Incoming HTTP request. |
callNextCallable | Callable advancing to the next layer. |
| Returns | |
Response | Response produced by the rest of the pipeline. |