Hello Djangonauts,

Just offering my Django implementation of CAS 1.0 authentication
backend in case anyone else is trying to use it.  (CAS is a single
sign-on protocol, you can read about it here:
http://www.ja-sig.org/products/cas/index.html)  It's a little trickier
to implement than other custom backends because in addition to a
backend, a custom view is needed to handle all the redirects that take
place.

You can download my project here:
http://exogen.case.edu/django_cas.tar.gz
You should just be able to add the cas application to your project and
adjust a few settings to make it work.

It stores user information in the standard auth User model, which lives
in django.contrib.auth.models.  This means you can still use nice
things like permissions and messages with CAS-authenticated users!

Brief guide:
- Set your SERVICE_URL in cas/__init__.py. For instance, I use
https://login.case.edu/cas/
- Set DEFAULT_REDIRECT_URL in cas/__init__.py.  Redirection will
normally send the user to the HTTP_REFERER so that they'll be sent back
to the page that requested login.  In the case where the user requests
/accounts/login/ directly, this setting controls where to send them.
- Add these to your URLconf:
    (r'^accounts/login/$', 'your_site.cas.views.login'),
    (r'^accounts/logout/$', 'your_site.cas.views.logout'),
- Set AUTHENTICATION_BACKENDS in settings.py to include
'your_site.cas.backends.CASBackend'.
- Don't forget to put 'your_site.cas' in INSTALLED_APPS and enable
'django.contrib.auth'.

Also see cas/backends.py if you have a way to automatically determine
the user's name and e-mail from the username (from LDAP for example),
or if you need to implement more of the CAS protocol (gateway, renew,
proxy...).

Questions and comments welcome.

--
Brian Beck
Adventurer of the First Order


--~--~---------~--~----~------------~-------~--~----~
 You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to