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:

AuthenticationViewsetRegistry()

A registry for authentication viewsets.

AuthentificationViewsetBase()

A viewset for authentications.

class django_helmholtz_aai.views.auth.base.AuthenticationViewsetRegistry

Bases: object

A registry for authentication viewsets.

Methods:

__init__()

get_default_viewset()

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:

viewsets

__init__() None
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: object

A viewset for authentications.

Classes:

AuthentificationView(**kwargs)

A view for handling the user authentication

Methods:

get_urls()

class AuthentificationView(**kwargs)

Bases: PermissionRequiredReasoningMixin, LoginUserMixin, UpdateUserMixin, View

A 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.

has_permission()

Check if the user has permission to login.

Attributes:

is_new_user

userinfo

The userinfo as obtained from the Helmholtz AAI.

class PermissionDeniedReasons(value)

Bases: TextChoices

An enumeration.

Attributes:

email_not_verified

vo_not_allowed

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() and synchronize_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_VOS and verifies that the email does not exist (if this is desired, see HELMHOLTZ_EMAIL_DUPLICATES_ALLOWED setting).

is_new_user
permission_denied_reason: PermissionDeniedReasons

The reason why the user cannot login.

request: Any
userinfo: Dict[str, Any]

The userinfo as obtained from the Helmholtz AAI.

The attributes of this dictionary are determined by the

get_urls()