问题
I have added the SAML_ATTRIBUTE_MAPPING in the settings.py with the below details. They are available with the inbuilt User model. The unknown user is getting created but additional attributes are not updated.
SAML_CREATE_UNKNOWN_USER = True SAML_ATTRIBUTE_MAPPING = { 'uid': ('username', ), 'mail': ('email', ), 'cn': ('first_name', ), 'sn': ('last_name', ), }
Also, I have extended user model. I read the documentation that we can use SAML_PROFILE_MODULE. I have an app called runbook. I defined a model called SamUser which is extended version of inbuilt User. Now how should i update the variable SAML_PROFILE_MODULE?
I tried doing , SAML_PROFILE_MODULE = runbook.models.SamUser
, it says module object doesn't have attribute models. Appreciate your help on this.
回答1:
SAML_ATTRIBUTE_MAPPING = {
'uid': ('username', ),
'mail': ('email', ),
'cn': ('first_name', ),
'sn': ('last_name', ),
}
replace above with
SAML_ATTRIBUTE_MAPPING = {
'uid': ('username', ),
'mail': ('email', ),
'first_name': ('first_name', ),
'last_name': ('last_name', ),
}
来源:https://stackoverflow.com/questions/36448401/djangosaml2-not-able-to-update-additional-attributes-to-inbuilt-django-user-mode