Skip to main content

Provides federated logins to django projects

Project description

Django Federated Login provides an authentication bridge between Django projects and OpenID-enabled identity providers. The bridge is pre-wired to be used with a single Google Apps domain, but could be extended to be linked with other OpenID providers also. It is different from other OpenID consumers as this consumer only allows connecting to a pre-defined identity provider.

The provided backend matches users based on the e-mail address returned from the identity provider. If no matching user could be found, a user account can optionally be created.

Installation

Installation with pip:

$ pip install django-federated-login

Add 'federated_login' to your list of installed apps:

settings.py:
INSTALLED_APPS = (
    ...
    'federated_login',
)

Add 'federated_login.auth.backend.EmailBackend' as authentication backend:

settings.py:
AUTHENTICATION_BACKENDS = (
    'federated_login.auth.backends.EmailBackend',
    'django.contrib.auth.backends.ModelBackend',
)

Provide the Google Apps domain to identify against:

settings.py:
FL_APPS_DOMAIN = 'webatoom.nl'

Register the views:

urls.py:
url(r'^federated/', include('federated_login.urls')),

Usage

Point your browser to /federated/login/. You might want to include a button to this url on the regular login page.

Extra settings

These are the customizable settings:

FL_APPS_DOMAIN

Google Apps domain to identify against.

FL_CREATE_USERS (Default: False)

Whether to create a user account when unknown e-mail address is presented.

FL_USER_FACTORY (Default: 'federated_login.auth.user_factory')

Function that is called when creating a user account.

FL_SSO_ENDPOINT (Default: Google Apps)

Override this setting to link with another OpenID identity provider.

FL_USER_CLASS (Default: 'django.contrib.auth.models.User')

Django model class to used to create and query for users.

Notes

This package depends on a fork of python-openid as the current upstream version (2.2.5) does not play well with a Google extension used by Google Apps identity provider. This fork is not listed on PyPi, so you have to include the following line in your requirements.txt to instruct pip where the patched version of python-openid can be found:

requirements.txt:
--find-links https://github.com/Bouke/python-openid/downloads

Project details


Download files

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

Source Distribution

django-federated-login-0.1.4.tar.gz (5.4 kB view details)

Uploaded Source

File details

Details for the file django-federated-login-0.1.4.tar.gz.

File metadata

File hashes

Hashes for django-federated-login-0.1.4.tar.gz
Algorithm Hash digest
SHA256 d5e9c0e0030b9032e49a54d1b3a9c9004b675dc9c21395ceeb0cee93076e9cb7
MD5 2ece86886250b94c61bcacf046626b06
BLAKE2b-256 8f9be31c5a0e53b45201f4e6c4d9c0655e0f538b30212724c2e7f82583c714bb

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page