djangosaml2 not able to update additional attributes to inbuilt django User Model

柔情痞子 提交于 2019-12-11 23:34:07

问题


  1. 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', ),
    }
    
  2. 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

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!