simple_openid_connect.integrations.django.models

simple_openid_connect database models

Classes

OpenidSession(*args, **kwargs)

A model to hold openid session information.

OpenidUser(*args, **kwargs)

A model which holds user related openid data.

OpenidUserManager(*args, **kwargs)

Custom user manager for the OpenidUser model.

class simple_openid_connect.integrations.django.models.OpenidSession(*args, **kwargs)[source]

A model to hold openid session information.

exception DoesNotExist
exception MultipleObjectsReturned
class simple_openid_connect.integrations.django.models.OpenidUser(*args, **kwargs)[source]

A model which holds user related openid data.

It is related to the user model instances via the openid relation.

exception DoesNotExist
exception MultipleObjectsReturned
update_session(token_response: TokenSuccessResponse, id_token: IdToken) OpenidSession[source]

Update session information based on the given openid token response.

If the token contains a session id, that session is updated with newer information and if not, a new session object is created.

class simple_openid_connect.integrations.django.models.OpenidUserManager(*args, **kwargs)[source]

Custom user manager for the OpenidUser model.

get_or_create_for_sub(sub: str) OpenidUser[source]

Dynamically get the existing model instance from the provided subject or create a new one if none already exists.

This method also ensures that a django auth model user exists which is linked to this OpenidUser.