|
I want to use CAS, Central Authentication Service as only login method in OSQA. I installed django_cas that allows authentication in Django with CAS. I configured everything as stated in the django_cas page and I changed the login URLs this way:
This seems to work at first, since it redirect me to the CAS server where I log myself in and then it redirects to the page I were before login, but it doesn't work because I am not authenticated (I still see the login link at the top right). Where should I look? @Gweakliem adds: I've been through the same exercise. I'm stuck right now figuring out what this error is. What I see in log/django.osqa.log is as follows:
|
|
After much trial and error, I have a working CAS-authenticated instance of OSQA. First of all, I had to modify the source for django_cas. What I needed was a method to verify the CAS ticket without creating a user - the default will try to create a User object and that doesn't do things the right way with respect to OSQA: site-packages/django_cas-2.0.3-py2.7.egg/django_cas/backends.py (this is just a snippet - the key point is that I refactored out a verify method from authenticate)
Next, I created a PopulatedCASBackend as suggested in the Google Code installation docs, however, the exception handler is somewhat different. I cribbed this code from the LDAP handler examples that I've found on here. The UserJoinsAction seems to be a key bit. forum/PopulatedCASBackend.py
Settings.py has a few new settings:
Also note that you have to modify urls.py as mentioned in the original question. There may be an easier way to do this, but this is what I found that works. The bit about modifying django_cas is a bit hacky but it seems like the path of least resistance, maybe they'll accept a patch to refactor the verify method, or maybe they'll be open to creating a callback for doing extended user creation. gweakliem, Could you share the code you had to change in django-cas?
(18 Aug '11, 07:55)
ultronion
It's the first code block, following the line "site-packages/django_cas-2.0.3-py2.7.egg/django_cas/backends.py (this is just a snippet - the key point is that I refactored out a verify method from authenticate)" The point is that I needed access to the verify() method without going through authenticate(ticket, service) in the case of a new user it doesn't set up the new user correctly, and there's no way to tell when a new user's been created so that you can fix it (that I know of, maybe someone can correct me). Refactoring out the verification allows you to simply authenticate and then handle the new user code as shown in the 2nd code block (PopulatedCASBackend.py)
(18 Aug '11, 11:18)
gweakliem
|
I've been through the same exercise. I'm stuck right now figuring out what this error is. What I see in log/django.osqa.log is as follows: