uapi.login package

Module contents

class uapi.login.AsyncLoginManager(async_session_store)

Bases: Generic[T]

Method generated by attrs for class AsyncLoginManager.

Parameters:

async_session_store (AsyncRedisSessionStore)

async_session_store: AsyncRedisSessionStore

The session store used for the sessions.

async logout(user_id)

Invalidate all sessions of user_id.

Parameters:

user_id (T)

Return type:

None

class uapi.login.AsyncLoginSession(user_id, session)

Bases: Generic[T]

Method generated by attrs for class AsyncLoginSession.

Parameters:
async login_and_return(user_id)

Set the current session as logged with the given user ID.

The produced headers need to be returned to the user to set the appropriate cookies.

Parameters:

user_id (T)

Return type:

dict[str, str]

async logout_and_return()
Return type:

dict[str, str]

user_id: T | None
uapi.login.configure_async_login(app, user_id_cls, redis_session_store, forbidden_response=Forbidden(ret=None, headers={}))

Configure the app for handling login sessions.

Parameters:
  • user_id_cls (type[T]) – The class of the user ID. Handlers will need to annotate the current_user_id parameter with this class or user_id_cls | None.

  • app (AsyncApp)

  • redis_session_store (AsyncRedisSessionStore)

  • forbidden_response (BaseResponse)

Return type:

AsyncLoginManager[T]