Skip to main content

An authentication backend for Django based on Polytechnique.org's auth-groupe-x SSO protocol.

Project description

django-authgroupex

This library provides a Django authentication backend based on Polytechnique.org’s auth-groupe-x SSO protocol.

Setup

The django-authgroupex package requires only a minimal pair of settings to work:

# Enable AuthGroupeX authentication backend
AUTHENTICATION_BACKENDS = (
    'django_authgroupex.auth.AuthGroupeXBackend',
    'django.contrib.auth.backends.ModelBackend',  # Optional
)

# Read secret key from file
AUTHGROUPEX_KEY = open('authgroupex.key', 'r').readline()

It should also be included in your projects urls.py file:

import django_authgroupex

authgroupex_view = django_authgroupex.AuthGroupeXUniqueView()
urlpatterns = patterns('',
    # Usual suspects here
    url(r'^xorgauth/', authgroupex_view.login_view, name='xorgauth'),
)

If you’re using the django.contrib.admin app, you may also override its login form:

from django.contrib import admin
admin.site.login = authgroupex_view.login_view

Settings

django-authgroupex provides the following settings:

  • AUTHGROUPEX_KEY: Required, the secret key used to connect to an AuthGroupeX-compatible server.

  • AUTHGROUPEX_ENDPOINT: The remote endpoint (an AuthGroupeX-compatible server). Default: https://www.polytechnique.org/auth-groupe-x/utf8

  • AUTHGROUPEX_FIELDS: The list of profile fields to require upon connection; order matters. Default: ('username', 'firstname', 'lastname', 'email')

  • AUTHGROUPEX_USER_MODEL: Model storing users. Default: auth.User

  • AUTHGROUPEX_USER_GROUP: Model storing groups. Default: auth.Group

  • AUTHGROUPEX_SUPERADMIN_PERMS: A list of AuthGroupeX permissions that enable the is_admin flag on this server. Default: ()

  • AUTHGROUPEX_STAFF_PERMS: A list of AuthGroupeX permissions that enable the is_staff flag on this server.

  • AUTHGROUPEX_DISABLE_DEADS: Whether a user connecting from a “dead” account should be switched to is_active=False Default: False

  • AUTHGROUPEX_GROUP: Name of the AuthGroupeX group to use for a single-group website. Default: ''

  • AUTHGROUPEX_MAP_GROUPS: Dict mapping an AuthGroupeX permission to a local group name. Default: {}

  • AUTHGROUPEX_RETURN_URL: Name of the (local) return url for successful logins. Default: settings.LOGIN_URL

  • AUTHGROUPEX_LOGIN_REDIRECT_URL: Name of the URL to redirect the user to after a successful login. Default: settings.LOGIN_REDIRECT_URL

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_authgroupex-0.1.0.tar.gz (6.8 kB view details)

Uploaded Source

File details

Details for the file django_authgroupex-0.1.0.tar.gz.

File metadata

File hashes

Hashes for django_authgroupex-0.1.0.tar.gz
Algorithm Hash digest
SHA256 50ba79e5ef5aca482b93b853e9fcaa51445f1fac55f2334fa5c1752f18d00caa
MD5 b946bec9d9af95f5b3c79d2db949bceb
BLAKE2b-256 c93533cbe66493b8e855c5ffd32311c457a18c7e2686f2ec30d1e5e1a0465297

See more details on using hashes here.

Supported by

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