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
Django profile objects refers to objects that are typically related to the User object using OneToOneField and store extra information about user. The documentation states:
If you are using Django user profile objects to store extra attributes about your user you can add those attributes to the SAML_ATTRIBUTE_MAPPING dictionary. For each (key, value) pair, djangosaml2 will try to store the attribute in the User model if there is a matching field in that model. Otherwise it will try to do the same with your profile custom model.
However, this is not the case and it confused the hell out of me trying to get it to work. This excerpt from authentication backend method handles attribute updates and it does not appear to look for profile object:
forattrindjango_attrs:
ifattr==user_lookup_key:
# Don't update user_lookup_key (e.g. username) (issue #245)# It was just used to find/create this user and might have# been changed by `clean_user_main_attribute`continueelifhasattr(user, attr):
user_attr=getattr(user, attr)
ifcallable(user_attr):
modified=user_attr(attr_value_list)
else:
modified=set_attribute(user, attr, attr_value_list[0])
has_updated_fields=has_updated_fieldsormodifiedelse:
logger.debug(f'Could not find attribute "{attr}" on user "{user}"')
If this is indeed true, let me know and I will send a PR with updated description.
The text was updated successfully, but these errors were encountered:
Yes, that approach works perfectly, but reading documentation I was under the impression that you can somehow specify profile object without having to subclass User model, e.g. by using specific related_name in OneToOneField or configure it in settings.py like you can AUTH_USER_MODEL.
It is not a huge issue, but it is better to minimize confusion anyway. Give me a day or two and I'll get back to you with a patch.
Django profile objects refers to objects that are typically related to the
User
object usingOneToOneField
and store extra information about user. The documentation states:However, this is not the case and it confused the hell out of me trying to get it to work. This excerpt from authentication backend method handles attribute updates and it does not appear to look for profile object:
If this is indeed true, let me know and I will send a PR with updated description.
The text was updated successfully, but these errors were encountered: