simple_openid_connect.integrations.django.apps#

Django AppConfig for this app

Functions

check_middleware(*args, **kwargs)

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)#
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 user_mapper: UserMapper#

A UserMapper instance of which the actual implementation is configured via django settings.

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_USER_MAPPER: str = 'simple_openid_connect.integrations.django.user_mapping.UserMapper')#

A pydantic model used to validate django settings

model_computed_fields: ClassVar[dict[str, ComputedFieldInfo]] = {}#

A dictionary of computed field names and their corresponding ComputedFieldInfo objects.

model_config: ClassVar[ConfigDict] = {'from_attributes': True}#

Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].

model_fields: ClassVar[dict[str, FieldInfo]] = {'OPENID_BASE_URI': FieldInfo(annotation=Union[str, NoneType], required=False), 'OPENID_CLIENT_ID': FieldInfo(annotation=str, required=True), 'OPENID_CLIENT_SECRET': FieldInfo(annotation=Union[str, NoneType], required=False), 'OPENID_ISSUER': FieldInfo(annotation=str, required=True), 'OPENID_REDIRECT_URI': FieldInfo(annotation=Union[str, NoneType], required=False, default='simple_openid_connect:login-callback'), 'OPENID_SCOPE': FieldInfo(annotation=str, required=False, default='openid'), 'OPENID_USER_MAPPER': FieldInfo(annotation=str, required=False, default='simple_openid_connect.integrations.django.user_mapping.UserMapper')}#

Metadata about the fields defined on the model, mapping of field names to [FieldInfo][pydantic.fields.FieldInfo].

This replaces Model.__fields__ from Pydantic V1.