server.web.routes.utils
Attributes
Classes
User information from OIDC authentication. |
Functions
|
Convert a dict to User TypedDict. |
|
Get the user from the session. |
|
Return the username part of the email address from the request. |
|
Check if a user is a member of the specified group. |
|
Check if a user is a member of the superuser group. |
|
Check if authentication is enabled. |
|
Create an anonymous user for unauthenticated mode. |
|
Get user or return anonymous user when auth is disabled. |
Module Contents
- server.web.routes.utils.logger
- class server.web.routes.utils.User
Bases:
TypedDictUser information from OIDC authentication.
Initialize self. See help(type(self)) for accurate signature.
- server.web.routes.utils.to_user_dict(data: Mapping[str, Any]) User
Convert a dict to User TypedDict.
- server.web.routes.utils.get_user(request: starlette.requests.Request) User
Get the user from the session.
A shared function to get the user from the session. Make it a method to mock in testing.
- server.web.routes.utils.get_request_username(request: starlette.requests.Request) str
Return the username part of the email address from the request.
- server.web.routes.utils.user_in_group(request: starlette.requests.Request, group: str) bool
Check if a user is a member of the specified group.
- server.web.routes.utils.is_super_user(user: User) bool
Check if a user is a member of the superuser group.
Checks if a user is a member of the superuser group defined in the
OIDC__ADMIN_GROUPconfiguration option.