Skip to main content

Django SSL Client Authentication

Project description


SSL authentication backend & middleware for Django for authenticating users with SSL client certificates

## License

MIT license, see LICENSE.txt for full text.

## Setup

### SSL
Set up nginx 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/nginx.conf

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.

On other platforms, there are many tutorials on how to do this with OpenSSL

Restart your ngninx (sudo nginx -s restart), make sure your green unicorn is
running and check that your https:// url loads your application and the
_server certificate is valid_. If it is not.

### This module

1. run (sudo python install) or install the latest release usning `pip install django_ssl_auth `
2. edit your ``
2. add `"django_ssl_auth.SSLClientAuthMiddleware"` to your `MIDDLEWARE_CLASSES`
3. add `"django_ssl_auth.SSLClientAuthBackend"` to your `AUTHENTICATION_BACKENDS`
4. add a function to map DN to username `USERNAME_FN = lambda x: x'`

#### Configuration
If your client certificates Distinguished names to not map 1:1,
you need to define a USERNAME_FN in your to extract the username
from the DN, the above example assumes 1:1 mapping.


Active directory integration.

## How to get help

Please do ask your questions on
I am active there, and more likely to answer you publicly.
Also, you can try catching Kimvais on #django@freenode

Project details

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Files for django-ssl-auth, version
Filename, size File type Python version Upload date Hashes
Filename, size django-ssl-auth- (3.6 kB) File type Dumb Binary Python version any Upload date Hashes View
Filename, size django-ssl-auth- (3.1 kB) File type Source Python version None Upload date Hashes View

Supported by

AWS AWS Cloud computing Datadog Datadog Monitoring Facebook / Instagram Facebook / Instagram PSF Sponsor Fastly Fastly CDN Google Google Object Storage and Download Analytics Huawei Huawei PSF Sponsor Microsoft Microsoft PSF Sponsor NVIDIA NVIDIA PSF Sponsor Pingdom Pingdom Monitoring Salesforce Salesforce PSF Sponsor Sentry Sentry Error logging StatusPage StatusPage Status page