djangosaml2无法更新附加属性到内置的django用户模型 [英] djangosaml2 not able to update additional attributes to inbuilt django User Model
问题描述
-
我已在settings.py中添加了SAML_ATTRIBUTE_MAPPING,其中包含以下详细信息。它们与内置的用户模型一起提供。未知用户正在创建,但其他属性不会更新。
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', ),
}
我已经扩展了用户模型。我阅读了我们可以使用SAML_PROFILE_MODULE的文档。我有一个名为runbook的应用程序。我定义了一个名为SamUser的模型,它是内置用户的扩展版本。现在我应该如何更新变量SAML_PROFILE_MODULE?
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?
我尝试过, SAML_PROFILE_MODULE = runbook。 models.SamUser
,它表示模块对象没有属性模型。感谢您的帮助。
I tried doing , SAML_PROFILE_MODULE = runbook.models.SamUser
, it says module object doesn't have attribute models. Appreciate your help on this.
推荐答案
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', ),
}
这篇关于djangosaml2无法更新附加属性到内置的django用户模型的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!