tarkatronic / django-ssl-auth

SSL authentication backend & middleware for Django for authenticating users with SSL client certificates
MIT License
27 stars 2 forks source link

DN to user model translation should be configurable in settings.py #2

Open jxgriffiths opened 6 years ago

jxgriffiths commented 6 years ago

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.

tarkatronic commented 6 years ago

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!