Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
pyroven is a library which provides Cambridge University Raven integration for Django
Python

Fetching latest commit…

Cannot retrieve the latest commit at this time

Failed to load latest commit information.
pyroven
.gitignore
.travis.yml
LICENSE
README.md
requirements-test.txt
setup.py
tox.ini

README.md

Pyroven: Cambridge University Raven integration for Django

Build Status

pyroven is a library which provides use of Cambridge University's Raven authentication for Django. It provides a Django authentication backend which can be added to AUTHENTICATION_BACKENDS in the Django settings module.

Use

Install django-pyroven using pip:

pip install django-pyroven

Then you can enable it within your Django project's settings.py:

AUTHENTICATION_BACKENDS = (
    'pyroven.backends.RavenAuthBackend',
    'django.contrib.auth.backends.ModelBackend'
)

This allows both normal Django login and Raven login.

You should then enable the URLs for pyroven:

urlpatterns = patterns('',
    ...
    url(r'', include('pyroven.urls')),
    ...
)

Minimum Config Settings

You then need to configure the app's settings. Raven has a live and test environments, the URL and certificate details are given below.

There are four minimum config settings:

PYROVEN_LOGIN_URL: a string representing the URL for the Raven login redirect.
PYROVEN_LOGOUT_URL: a string representing the logout URL for Raven
PYROVEN_RETURN_URL: the URL of your app which the Raven service should 
    return the user to after authentication
PYROVEN_CERTS: a dictionary including key names and their associated 
    certificates which can be downloaded from the Raven project pages.

The final major setting is:

PYROVEN_CREATE_USER = False

This defaults to False, but when True, allows the autocreation of users who have been successfully authenticated by Raven, but do not exist in the local database. The user is created with set_unusable_password().

An example, referencing the Raven test environment is given below:

PYROVEN_LOGIN_URL = 'https://demo.raven.cam.ac.uk/auth/authenticate.html'
PYROVEN_LOGOUT_URL = 'https://demo.raven.cam.ac.uk/auth/logout.html'
PYROVEN_RETURN_URL = 'http://your.example.com/raven_return/'
PYROVEN_CERTS = {'901': """-----BEGIN CERTIFICATE-----
MIIDzTCCAzagAwIBAgIBADANBgkqhkiG9w0BAQQFADCBpjELMAkGA1UEBhMCR0Ix
EDAOBgNVBAgTB0VuZ2xhbmQxEjAQBgNVBAcTCUNhbWJyaW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fPFIqaSntlYMxKKB5ba/tIAMzyAOHxdEM5hi1DXRsOok3ElWjOw9oN
6Psvk/hLUN+YfC1saaUs3oh+OTfD7I4gRTbXPgsd6JgJQ0TQtuGygJdaht9cRBHW
wOq24EIbX5LquL9w+uvnfXw=
-----END CERTIFICATE-----
""")

Additional Config Settings

Extra settings which can be used to fine tune the performance of django-pyroven include:

PYROVEN_MAX_CLOCK_SKEW = ''
PYROVEN_TIMEOUT = ''
PYROVEN_IACT = ''
PYROVEN_AAUTH = ''

The details of these can be found in the Raven WLS protocol documentation, here.

Something went wrong with that request. Please try again.