-
Notifications
You must be signed in to change notification settings - Fork 7
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
CAS 3.0 support #2
base: master
Are you sure you want to change the base?
Conversation
CAS 3.0 support To support CAS 3.0,the attribute mapper should be like: ```python def populate_user(user, authentication_response): if authentication_response is not None: if authentication_response.has_key('is_superuser'): user.is_superuser = authentication_response['is_superuser'] if authentication_response.has_key('is_staff'): user.is_staff = authentication_response['is_staff'] if authentication_response.has_key('givenName'): user.first_name = authentication_response['givenName'] if authentication_response.has_key('sn'): user.last_name = authentication_response['sn'] if authentication_response.has_key('email'): user.email = authentication_response['email'] pass ```
Can you add a unit test for this? Also, do you know how you can determine if the response you get passed in is protocol version 2 or 3? Since they give very different attribute dictionaries, it would be nice to either add something to both of them, or at least know how to differentiate i.e. if authentication_response is not None:
if authentication_response.has_key('sn'):
# Protocol 3.0 logic
elif authentication_response.find(CAS + 'authenticationSuccess/' + CAS + 'attributes' , namespaces=NSMAP):
# Protocol 2.0 attribute handler |
What about this if CAS_VERSION=='3':
pass |
Well, you won't necessarily know the version in the client at configuration time. i.e. I upgrade my CAS from Jasig 3.5 to 4.x then the attribute mapper would fail. In the worst case, I think my code example above would work as an example, and I could update our reference version to have that. The more I think about it, that is probably the only way to do it and maintain backwards compatibility with the current attribute mapper's out there. |
.CAS_VERSION was 2 on init.py .if people try to use cas 3 ,must set var CAS_VERSION on configuration first. |
I totally missed that in init, and that it came from configuration already. Sorry about that. I just verified that there aren't issues with this in our current setup, so it looks good. I would just really like a unit test for it since I can't really verify myself without setting up a CAS 3.0 server. We will also need to have https://github.com/edx/edx-platform/pull/6127 merge before I merge this. |
@carsongee what do you think we should do with this and mitocw/mitx_cas_mapper#1 |
I think it would be nice if we wrote tests and validated that this works with a CAS 3.0 server as it would be valuable to the edx community. A better option may be switching the platform to using https://github.com/mingchen/django-cas-ng as it is a much better maintained fork, though they only test down to Django 1.5, so it may not work with our 1.4 installation |
CAS 3.0 support
To support CAS 3.0,the attribute mapper should be like:
@carsongee