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

class SessionManager: (source)

Constructor: SessionManager(app, cache)

View In Hierarchy

Coordinates the session lifecycle for every HTTP request.

This class is a coordinator only. It never stores session data, never interprets the session payload, and never duplicates logic that belongs to Session or to the backing store.

Parameters
configResolved session configuration entity.
storePre-built backing-store instance.
Method __deleteCookie Set an expired cookie to instruct the browser to clear it.
Method __init__ Initialise the manager, pre-computing all request-invariant values.
Async Method __invalidateSession Remove the session record and expire the cookie on response.
Async Method __persist Write the current session state to the backing store.
Method __register Register the session in the application container.
Method __resolveStore Resolve and return the configured session store implementation.
Async Method __restore Load a session from the store, or return a blank lazy session.
Async Method __rotateId Replace the session ID, deleting the old record from the store.
Method __setCookie Attach the session identifier cookie to response.
Async Method abort Persist pending revocation when a request cannot produce a response.
Async Method save Persist the session and set the cookie on response.
Async Method start Restore or create a session for the incoming request.
Class Variable __slots__ Undocumented
Instance Variable _app Undocumented
Instance Variable _cookie_domain Undocumented
Instance Variable _cookie_http_only Undocumented
Instance Variable _cookie_max_age Undocumented
Instance Variable _cookie_name Undocumented
Instance Variable _cookie_partitioned Undocumented
Instance Variable _cookie_path Undocumented
Instance Variable _cookie_same_site Undocumented
Instance Variable _cookie_secure Undocumented
Instance Variable _lifetime_delta Undocumented
Instance Variable _renewal_delta Undocumented
Instance Variable _renewal_window Undocumented
Instance Variable _store Undocumented
Instance Variable _track_previous_url Undocumented
Property tracksPreviousUrl Return whether session middleware remembers successful navigation URLs.
def __deleteCookie(self, response: Response): (source)

Set an expired cookie to instruct the browser to clear it.

Parameters
response:ResponseThe outgoing response.
Returns
NoneUndocumented
def __init__(self, app: IApplication, cache: ICacheManager): (source)

Initialise the manager, pre-computing all request-invariant values.

Parameters
app:IApplicationThe application instance.
cache:ICacheManagerThe application's cache manager, injected so the cache-backed store can be built without depending on the Cache facade's pin state.
Returns
NoneUndocumented
async def __invalidateSession(self, response: Response, session: Session): (source)

Remove the session record and expire the cookie on response.

Parameters
response:ResponseResponse on which the expired cookie is set.
session:SessionThe session to remove.
Returns
NoneUndocumented
async def __persist(self, session: Session) -> bool: (source)

Write the current session state to the backing store.

Parameters
session:SessionThe session to persist. session.id must not be None.
Returns
boolFalse if a restored session has already been revoked or expired.
def __register(self, session: Session): (source)

Register the session in the application container.

Parameters
session:SessionThe session to register.
Returns
NoneUndocumented
def __resolveStore(self, base_path: Path, config: SessionConfig, cache: ICacheManager) -> ISessionStore: (source)

Resolve and return the configured session store implementation.

Parameters
base_path:PathBase project path used to resolve file-store directories.
config:SessionConfigSession configuration containing the selected driver.
cache:ICacheManagerThe application's cache manager, used by the cache driver.
Returns
ISessionStoreFile-backed store when the file driver is selected; otherwise an in-memory store.
async def __restore(self, session_id: str) -> Session: (source)

Load a session from the store, or return a blank lazy session.

The store is trusted to handle expiry: a None return means the record was absent or already expired.

Parameters
session_id:strThe identifier read from the session cookie.
Returns
SessionRestored session, or a blank lazy session on cache miss.
async def __rotateId(self, session: Session) -> bool: (source)

Replace the session ID, deleting the old record from the store.

Parameters
session:SessionThe session whose ID is to be rotated.
Returns
boolFalse if another request has already invalidated the old ID.
def __setCookie(self, response: Response, session_id: str): (source)

Attach the session identifier cookie to response.

Parameters
response:ResponseThe outgoing response.
session_id:strThe session identifier to embed in the cookie value.
Returns
NoneUndocumented
async def abort(self, session: Session): (source)

Persist pending revocation when a request cannot produce a response.

Parameters
session:SessionSession belonging to a failed or cancelled request.
Returns
NoneInvalidated or superseded IDs are deleted; no new session is issued.
async def save(self, response: Response, session: Session): (source)

Persist the session and set the cookie on response.

No-op when the session was never activated. With a renewal interval, unchanged scalar payloads retain their existing store and cookie expiry until the deadline; mutable payloads are always persisted. Browser session cookies still omit Max-Age when expire_on_close is enabled.

Parameters
response:ResponseOutgoing HTTP response.
session:SessionThe session returned by start().
Returns
NoneUndocumented
async def start(self, request: Request) -> Session: (source)

Restore or create a session for the incoming request.

Parameters
request:RequestThe incoming HTTP request.
Returns
SessionAn active or blank lazy session, with flash data aged.
__slots__: tuple[str, ...] = (source)

Undocumented

Undocumented

_cookie_domain: str | None = (source)

Undocumented

_cookie_http_only: bool = (source)

Undocumented

_cookie_max_age: int | None = (source)

Undocumented

_cookie_name: str = (source)

Undocumented

_cookie_partitioned: bool = (source)

Undocumented

_cookie_path: str = (source)

Undocumented

_cookie_same_site: str = (source)

Undocumented

_cookie_secure: bool = (source)

Undocumented

_lifetime_delta: timedelta = (source)

Undocumented

_renewal_delta = (source)

Undocumented

_renewal_window = (source)

Undocumented

_store: ISessionStore = (source)

Undocumented

_track_previous_url = (source)

Undocumented

tracksPreviousUrl: bool = (source)

Return whether session middleware remembers successful navigation URLs.

Returns
boolWhether previous-page tracking is enabled for this manager.