You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
We should enable pycloak to set claims from the token on the Django user model.
Let's take following example:
claim birthday
User model has a UserProfile, which has the field birth_day, i.e. user.profile.birth_day
We need a setting PYCLOAK_CLAIM_TO_USER_MAPPING, which maps the name of the claim to the field of the user. This needs to support nested related lookups, separated by dot-notation. Optionally a callback function can be specified, if the value needs parsing/processing.
We need a setting PYCLOAK_CLAIM_SKIP_MISSING. If this is True, pycloak skips when the claim is not present in the token and logs a warning. If this is False, pycloak will raise a django.core.exceptions.ImproperlyConfigured error.
We need a setting PYCLOAK_CLAIM_IGNORE_VALIDATION_ERRORS. If this is True, pycloak logs a warning when a validation error is raised. If this is False, pycloak will raise the exception.
The field on the user model is set in the middleware at 7. login user. We only need to set it, if we login the user or if it's the same user with a new token.
The text was updated successfully, but these errors were encountered:
We should enable pycloak to set claims from the token on the Django user model.
Let's take following example:
birthday
UserProfile
, which has the fieldbirth_day
, i.e.user.profile.birth_day
We need a setting
PYCLOAK_CLAIM_TO_USER_MAPPING
, which maps the name of the claim to the field of the user. This needs to support nested related lookups, separated by dot-notation. Optionally a callback function can be specified, if the value needs parsing/processing.Example:
We need a setting
PYCLOAK_CLAIM_SKIP_MISSING
. If this isTrue
, pycloak skips when the claim is not present in the token and logs a warning. If this isFalse
, pycloak will raise adjango.core.exceptions.ImproperlyConfigured
error.We need a setting
PYCLOAK_CLAIM_IGNORE_VALIDATION_ERRORS
. If this isTrue
, pycloak logs a warning when a validation error is raised. If this isFalse
, pycloak will raise the exception.The field on the user model is set in the middleware at
7. login user
. We only need to set it, if we login the user or if it's the same user with a new token.The text was updated successfully, but these errors were encountered: