simple_openid_connect.integrations.django.apps#

Django AppConfig for this app

Classes

OpenidAppConfig(app_name, app_module)

SettingsModel(*, OPENID_ISSUER, OPENID_CLIENT_ID)

A pydantic model used to validate django settings

class simple_openid_connect.integrations.django.apps.OpenidAppConfig(app_name, app_module)#
property create_user_func: Callable[[IdToken], Any]#

The function which is configured via django settings and which creates new users based on id tokens.

get_client(own_base_uri: HttpRequest | str | None = None) OpenidClient#

Get an OpenidClient instance that is appropriate for usage in django.

It is automatically configured via django settings.

Parameters:

own_base_uri – The base url of this application which will be used to construct a redirect_uri back to it. Can also be the current request in which case {scheme}://{host} of it will be used as the base url. If this parameter is not given, only the OPENID_BASE_URI setting is used. In any case, if the OPENID_BASE_URI setting is set, it will be used instead.

Raises:

ImproperlyConfigured – when no own_base_uri is given and the OPENID_BASE_URI is also None

classmethod get_instance() OpenidAppConfig#

Retrieve the currently used instance from django’s app registry

ready() None#

Called when django starts.

Performs settings validation and raises ImproperlyConfigured if necessary.

property safe_settings: SettingsModel#

type-validated version of django settings

property update_user_func: Callable[[Any, IdToken], None]#

The function which is configured via django settings and which updates user objects based on id tokens.

class simple_openid_connect.integrations.django.apps.SettingsModel(*, OPENID_ISSUER: str, OPENID_CLIENT_ID: str, OPENID_CLIENT_SECRET: str | None = None, OPENID_SCOPE: str = 'openid', OPENID_REDIRECT_URI: str | None = 'simple_openid_connect:login-callback', OPENID_BASE_URI: str | None = None, OPENID_CREATE_USER_FUNC: str = 'simple_openid_connect.integrations.django.user_mapping.create_user_from_token', OPENID_UPDATE_USER_FUNC: str = 'simple_openid_connect.integrations.django.user_mapping.update_user_from_token')#

A pydantic model used to validate django settings