django-ssl-auth
django-ssl-auth copied to clipboard
DN to user model translation should be configurable in settings.py
I think it makes more sense to allow the user to configure this in settings.py rather than forcing them to create a module that maps DN elements to the user model. IIRC the implementation of USER_DATA_FN is NOT python3 friendly although I would need to do some digging to jog my memory as to why.
Define a function that can return a dictionary with fields that are required by your user model, e.g. USER_DATA_FN = 'django_ssl_auth.fineid.user_dict_from_dn is a sample implementation that takes the required fields from the DN of a Finnish government issued ID smart card for the contrib.auth.models.User.
I've been tossing around in my head if there's a way I could make the configuration a little more like django-auth-ldap, perhaps something like this: https://django-auth-ldap.readthedocs.io/en/1.2.x/users.html#easy-attributes
Also, speaking of django-auth-ldap, I'm wondering if there might be a good way to create an integration with that package, especially since Active Directory integration was already in the TODO list here. Anyhow, that's perhaps rambling a bit.
Any other thoughts are welcome!