simple_openid_connect.integrations.django.user_mapping#
Default implementations for mapping tokens to user objects
Functions
|
Inspect the given user model, discover its attributes based on some heuristics and fetch their values from the id token. |
|
Implementation for creating a user object from an id token. |
|
Implementation for updating an existing user object with new data |
- simple_openid_connect.integrations.django.user_mapping.automap_user_attrs(user_t: Type[AbstractBaseUser], id_token: IdToken) Mapping[str, Any]#
Inspect the given user model, discover its attributes based on some heuristics and fetch their values from the id token.
- Parameters
user_t – The user model type
id_token – The id token which contains information about the user
- Returns
A mapping of user model attribute to values as found in the id token
- simple_openid_connect.integrations.django.user_mapping.create_user_from_token(id_token: IdToken) Any#
Implementation for creating a user object from an id token.
It works by calling
automap_user_attrs()with the token and passing that to the user models objects.create() method.- Parameters
id_token – The id token
- Returns
The created user object
- simple_openid_connect.integrations.django.user_mapping.update_user_from_token(user: Any, id_token: IdToken) None#
Implementation for updating an existing user object with new data
This works by calling
automap_user_attrs()with the token and setting all those attributes on the user object.- Parameters
user – The user object that should be updated.
id_token – The token which contains user information.