GithubHelp home page GithubHelp logo

django-ssl-auth.2.555's Introduction

The authoritative repository for this project is maintained by Joey Wilhelm

<< Kimvais, 2017-10-14

django-ssl-auth

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. 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 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.

This module

  1. run setup.py (sudo python setup.py install) or install the latest release usning pip install django_ssl_auth
  2. edit your settings.py
    1. add "django_ssl_auth.SSLClientAuthMiddleware" to your MIDDLEWARE_CLASSES
    2. add "django_ssl_auth.SSLClientAuthBackend" to your AUTHENTICATION_BACKENDS

Configuration

There are two things you need to do in settings.py

  1. 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.
  2. To automatically create Users for all valid certificate holders, set AUTOCREATE_VALID_SSL_USERS = True. Auto-created users will be set to inactive by default, consider using the User.is_active field in your LOGIN_DIRECT_URL view to notifying the user of their status.

For details, see testapp/ssltest/settings.py

Smart Card support

For (Finnish) instructions see doc/fineid/FINEID.md

TODO

  • Active directory integration.

How to get help

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

django-ssl-auth.2.555's People

Contributors

f1shear avatar jquepi avatar jwilhelm-godaddy avatar kimvais avatar linville avatar saghul avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.