SessionStore

class gafaelfawr.session.SessionStore(key: str, verifier: TokenVerifier, redis: Redis, logger: BoundLogger)

Bases: object

Stores and retrieves sessions.

Parameters:

Methods Summary

analyze_handle(handle) Analyze a session handle and return its expanded information.
delete_session(key, pipeline) Delete a session.
get_session(handle) Retrieve and decrypt the session for a handle.
store_session(session, pipeline) Store a session.

Methods Documentation

analyze_handle(handle: SessionHandle) → Dict[str, Any]

Analyze a session handle and return its expanded information.

Parameters:handle (gafaelfawr.session.SessionHandle) – The session handle to analyze.
Returns:output – The contents of the session handle and its underlying session. This will include the session key and secret, the session it references, and the token that session contains.
Return type:Dict[str, Any]
delete_session(key: str, pipeline: Pipeline) → None

Delete a session.

To allow the caller to batch this with other Redis modifications, the deletion is done using the provided pipeline. The caller is responsible for executing the pipeline.

Parameters:
get_session(handle: SessionHandle) → Optional[Session]

Retrieve and decrypt the session for a handle.

Parameters:handle (SessionHandle) – The handle corresponding to the session.
Returns:session – The corresponding session, or None if no session exists for this session handle.
Return type:Session or None
store_session(session: Session, pipeline: Optional[Pipeline] = None) → None

Store a session.

To allow the caller to batch this with other Redis modifications, if a pipeline is provided, the session will be stored but the pipeline will not be executed. In this case, the caller is responsible for executing the pipeline.

Parameters: