Django Federated Login provides an authentication bridge between Django projects and OpenID-enabled identity providers.

Related tags

Django django sso openid
Overview

Django Federated Login

Build Status Test Coverage PyPI

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.

I would love to hear your feedback on this package. If you run into problems, please file an issue on GitHub, or contribute to the project by forking the repository and sending some pull requests.

Compatible with Django 1.4, 1.5 and 1.6 on Python 2.6, 2.7, 3.2 and 3.3. Python 3 is supported through the python3-openid fork.

Installation

Installation with pip:

$ pip install django-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',
)

Add 'federated_login' as installed app:

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

Provide the Google Apps domain to identify against:

settings.py:
FL_APPS_DOMAIN = 'webatoom.nl'

For Django 1.6, need to configure session serializer:

settings.py:
SESSION_SERIALIZER = 'django.contrib.sessions.serializers.PickleSerializer'

Register the views:

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

Sync or migrate your database:

python manage.py syncdb
# or if you use South:
python manage.py migrate federated_login

Usage

Point your browser to /federated/login/. You might want to include a button to this url on the regular login page. You could also use the federated login page as the default login page, replacing the username and password login pages. To do this, configure the LOGIN_ settings:

settings.py:
LOGIN_REDIRECT_URL = '/'
LOGIN_URL = '/federated/login/'

Settings

These are the customizable settings:

FL_APPS_DOMAIN
Google Apps domain to identify against. Can be overriden by FL_SSO_ENDPOINT.
FL_USER_FACTORY (Default: 'federated_login.user_factories.normal')
Function that is called when creating a user account. Set to None to disable creation of new users. There is also 'federated_login.user_factories.staff' that creates staff users and 'federated_login.user_factories.superuser' that creates superusers.
FL_SSO_ENDPOINT (Default: Google Apps)
Override this setting to link with another OpenID identity provider. The FL_APPS_DOMAIN setting will have no effect when providing a custom FL_SSO_ENDPOINT.
FL_USER_CLASS (Default: 'django.contrib.auth.models.User')
Django model class to used to create and query for users.
FL_PATCH_ADMIN (Default: True)
Django's admin site is automatically patched to use federated login. Set this setting to False to disable this feature. You can call federated_login.admin.patch_admin() and federated_login.admin.unpatch_admin() to respectively patch and unpatch the admin site.
You might also like...
A Django application that provides country choices for use with forms, flag icons static files, and a country field for models.

Django Countries A Django application that provides country choices for use with forms, flag icons static files, and a country field for models. Insta

The Django Leaflet Admin List package provides an admin list view featured by the map and bounding box filter for the geo-based data of the GeoDjango.
The Django Leaflet Admin List package provides an admin list view featured by the map and bounding box filter for the geo-based data of the GeoDjango.

The Django Leaflet Admin List package provides an admin list view featured by the map and bounding box filter for the geo-based data of the GeoDjango. It requires a django-leaflet package.

Django API that scrapes and provides the last news of the city of Carlos Casares by semantic way (RDF format).

"Casares News" API Api that scrapes and provides the last news of the city of Carlos Casares by semantic way (RDF format). Usage Consume the articles

A Django application that provides country choices for use with forms, flag icons static files, and a country field for models.

Django Countries A Django application that provides country choices for use with forms, flag icons static files, and a country field for models. Insta

A drop-in replacement for django's ImageField that provides a flexible, intuitive and easily-extensible interface for quickly creating new images from the one assigned to the field.

django-versatileimagefield A drop-in replacement for django's ImageField that provides a flexible, intuitive and easily-extensible interface for creat

A simple app that provides django integration for RQ (Redis Queue)
A simple app that provides django integration for RQ (Redis Queue)

Django-RQ Django integration with RQ, a Redis based Python queuing library. Django-RQ is a simple app that allows you to configure your queues in djan

:couple: Multi-user accounts for Django projects

django-organizations Summary Groups and multi-user account management Author Ben Lopatin (http://benlopatin.com / https://wellfire.co) Status Separate

Duckiter will Automatically dockerize your Django projects.

Duckiter Duckiter will Automatically dockerize your Django projects. Requirements : - python version : python version 3.6 or upper version - OS :

Analytics services for Django projects

django-analytical The django-analytical application integrates analytics services into a Django project. Using an analytics service with a Django proj

Comments
  • PyPI release does not support Django 1.6

    PyPI release does not support Django 1.6

    Hi. Thanks for a fantastic library!

    Just wondering if you could push a new release to PyPI that works with Django 1.6. I'm just installing directly from the Github repo at the moment, but it'd be great to be able to pin to a new version on PyPI.

    question 
    opened by jacobwegner 4
  • Is it possible to use django-federated-login on a single project with virtual hosts?

    Is it possible to use django-federated-login on a single project with virtual hosts?

    I have a django project that has virtual hosts enabled then I have many sites that share the same code except database, settings files and wsgi scripts.

    For each site I have a site-*.wsgi, site-*-settings.py, site-*-settings-local.py. I want to install django-federated-login but I should to add for each site 'federated_login' as installed app.

    Can django-federated-login work on a single project with virtual hosts?

    Thanks!

    question 
    opened by aoussarmustapha 1
  • Server denied check_authentication

    Server denied check_authentication

    As of recently users are unable to login, the error log shows:

    Authentication failed: Server denied check_authentication
    

    It seems to be related to this question on SO.

    bug 
    opened by Bouke 1
  • Use a setting for User model class.

    Use a setting for User model class.

    A setting FL_USER_CLASS was added. It holds the User class information. It is useful when the app isn't using the django,auth.models.User. In urls.py the LOGIN_URL is used instead of hardcoded '/sign-in/'

    enhancement 
    opened by aniav 1
Owner
Bouke Haarsma
Bouke Haarsma
Django Login Api With Python

How to run this project Download and extract this project Create an environment and install all the libraries from requiements.txt pip freeze -r requi

Vikash Kisku 1 Dec 10, 2021
Keep track of failed login attempts in Django-powered sites.

django-axes Axes is a Django plugin for keeping track of suspicious login attempts for your Django based website and implementing simple brute-force a

Jazzband 1.1k Dec 30, 2022
django-reversion is an extension to the Django web framework that provides version control for model instances.

django-reversion django-reversion is an extension to the Django web framework that provides version control for model instances. Requirements Python 3

Dave Hall 2.8k Jan 2, 2023
Rosetta is a Django application that eases the translation process of your Django projects

Rosetta Rosetta is a Django application that facilitates the translation process of your Django projects. Because it doesn't export any models, Rosett

Marco Bonetti 909 Dec 26, 2022
Cookiecutter Django is a framework for jumpstarting production-ready Django projects quickly.

Cookiecutter Django Powered by Cookiecutter, Cookiecutter Django is a framework for jumpstarting production-ready Django projects quickly. Documentati

Daniel Feldroy 10k Dec 31, 2022
A handy tool for generating Django-based backend projects without coding. On the other hand, it is a code generator of the Django framework.

Django Sage Painless The django-sage-painless is a valuable package based on Django Web Framework & Django Rest Framework for high-level and rapid web

sageteam 51 Sep 15, 2022
User Authentication In Django/Ajax/Jquery

User Authentication In Django/Ajax/Jquery Demo: Authentication System Using Django/Ajax/Jquery Demo: Authentication System Using Django Overview The D

Suman Raj Khanal 10 Mar 26, 2022
A simple Django middleware for Duo V4 2-factor authentication.

django-duo-universal-auth A lightweight middleware application that adds a layer on top of any number of existing authentication backends, enabling 2F

Adam Angle 1 Jan 10, 2022
This is raw connection between redis server and django python app

Django_Redis This repository contains the code for this blogpost. Running the Application Clone the repository git clone https://github.com/xxl4tomxu9

Tom Xu 1 Sep 15, 2022
The best way to have DRY Django forms. The app provides a tag and filter that lets you quickly render forms in a div format while providing an enormous amount of capability to configure and control the rendered HTML.

django-crispy-forms The best way to have Django DRY forms. Build programmatic reusable layouts out of components, having full control of the rendered

null 4.6k Jan 7, 2023