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
class GuestMiddleware(ResolveIdentityMiddleware): (source)
Constructor: GuestMiddleware(app, manager, permissions)
Keep web login and registration routes restricted to guests.
Authenticated browsers are sent to the page declared in auth.session.home. Subclasses pin a different destination by overriding the redirect_to class attribute.
| Method | __init__ |
Initialise the middleware with its collaborators. |
| Async Method | handle |
Continue for guests and reject authenticated access to guest routes. |
| Class Variable | __slots__ |
Declare the instance attribute slots reserved by this class. |
| Class Variable | redirect |
Explicit destination replacing the configured home page. |
| Instance Variable | _home |
Redirect destination for users who are already authenticated. |
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.IApplication | Application exposing the auth.session configuration. |
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. |
Continue for guests and reject authenticated access to guest routes.
| Parameters | |
request:orionis.http.Request | Incoming request. |
callorionis.http.NextCallable | Remaining route pipeline. |
| Returns | |
orionis.http.Response | Guest response or a browser redirect to the home page. |
| Raises | |
orionis.auth.AuthorizationException | If an authenticated JSON or AJAX client accesses a guest-only route. |