SSL authentication backend & middleware for Django for authenticating users with SSL client certificates
MIT license, see LICENSE.txt for full text.
Set up apache and create SSL certificates for your server and set up the paths to server private key, server certificate and CA certificate used to sign the client certificates. Example configuration file is in samples/apachesite
If you are on OS X, I suggest OS X KeyChain access for doing this for testing, as it will automatically make your client certificates available in all both Google chrome & Safari. Instructions can be found e.g. http://www.dummies.com/how-to/content/how-to-become-a-certificate-authority-using-lion-s.html
On other platforms, there are many tutorials on how to do this with OpenSSL e.g. http://pages.cs.wisc.edu/~zmiller/ca-howto/
Restart your apache (sudo service apache2 restart), and check that your https:// url loads your application and the server certificate is valid.
- run setup.py (sudo python setup.py install) or install the latest release usning
pip install django_ssl_auth
- edit your
settings.py
- add
"django_ssl_auth.SSLClientAuthMiddleware"
to yourMIDDLEWARE_CLASSES
- add
"django_ssl_auth.SSLClientAuthBackend"
to yourAUTHENTICATION_BACKENDS
- add
There are two things you need to do in settings.py
- 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.lotw.user_dict_from_dn
is a sample implementation that takes the required fields from the DN of an ARRL Logbook of the World certificate for thecontrib.auth.models.User
. - To automatically create
User
s for all valid certificate holders, setAUTOCREATE_VALID_SSL_USERS = True
For details, see testapp/ssltest/settings.py
For (Finnish) instructions see doc/fineid/FINEID.md
- Active directory integration.
Please do ask your questions on http://stackoverflow.com/ I am active there, and more likely to answer you publicly. Also, you can try catching Kimvais on #django@freenode