Base viewset for authentication
This module defines the base viewset for handling authentication and user creation. Furthermore it defines a registry to register the viewsets for a given key.
Classes:
A registry for authentication viewsets. |
|
A viewset for authentications. |
- class django_helmholtz_aai.views.auth.base.AuthenticationViewsetRegistry
Bases:
objectA registry for authentication viewsets.
Methods:
__init__()Get the viewset from the :mod:`~django_helmholtz_aai.app_settings.
get_viewset(key)Get the viewset for a given key.
register_viewset(key, viewset)unregister_viewset(key)Unregister a viewset for the given key.
Attributes:
- get_default_viewset() AuthentificationViewsetBase
Get the viewset from the :mod:`~django_helmholtz_aai.app_settings.
- get_viewset(key: str | List[str]) AuthentificationViewsetBase
Get the viewset for a given key.
- register_viewset(key: str | List[str], viewset: AuthentificationViewsetBase)
- unregister_viewset(key: str | List[str]) AuthentificationViewsetBase | None
Unregister a viewset for the given key.
- viewsets: Dict[Tuple, AuthentificationViewsetBase] = {}
- class django_helmholtz_aai.views.auth.base.AuthentificationViewsetBase
Bases:
objectA viewset for authentications.
Classes:
AuthentificationView(**kwargs)A view for handling the user authentication
Methods:
get_urls()- class AuthentificationView(**kwargs)
Bases:
PermissionRequiredReasoningMixin,LoginUserMixin,UpdateUserMixin,ViewA view for handling the user authentication
Classes:
PermissionDeniedReasons(value)An enumeration.
Methods:
get(request)Login the Helmholtz AAI user and update the data.
handle_new_user(userinfo)Handle the registration of a new user.
Check if the user has permission to login.
Attributes:
The userinfo as obtained from the Helmholtz AAI.
- class PermissionDeniedReasons(value)
Bases:
TextChoicesAn enumeration.
Attributes:
- email_not_verified = 'email_not_verified'
- vo_not_allowed = 'vo_not_allowed'
- aai_user: models.HelmholtzUser
- get(request)
Login the Helmholtz AAI user and update the data.
This method logs in the aai user (or creates one if it does not exist already). Afterwards we update the user info from the information on the Helmholtz AAI using the
update_user()andsynchronize_vos()methods.
- handle_new_user(userinfo: Dict[str, Any]) Tuple[HelmholtzUser | None, Any]
Handle the registration of a new user.
- has_permission() bool
Check if the user has permission to login.
This method checks, if the user belongs to the specified
HELMHOLTZ_ALLOWED_VOSand verifies that the email does not exist (if this is desired, seeHELMHOLTZ_EMAIL_DUPLICATES_ALLOWEDsetting).
- is_new_user
- permission_denied_reason: PermissionDeniedReasons
The reason why the user cannot login.
- request: Any
- get_urls()