New configuration for third_party_auth & shibboleth/SAML SSO#8155
New configuration for third_party_auth & shibboleth/SAML SSO#8155bradenmacdonald merged 13 commits intoopenedx:feature/shibboleth-tpafrom
Conversation
|
Thanks for the pull request, @bradenmacdonald! It looks like you're a member of a company that does contract work for edX. If you're doing this work as part of a paid contract with edX, you should talk to edX about who will review this pull request. If this work is not part of a paid contract with edX, then you should ensure that there is an OSPR issue to track this work in JIRA, so that we don't lose track of your pull request. To automatically create an OSPR issue for this pull request, just visit this link: http://openedx-webhooks.herokuapp.com/github/process_pr?repo=edx%2Fedx-platform&number=8155 |
d19f8b9 to
9a46db9
Compare
|
@bradenmacdonald I've looked through the code once without finding any big issues. I don't have time left today, but I hope I will get to testing this tomorrow before the meeting. Is there anything in particular I could do to test this? Something like configuring a provider in the old version, migrating, and then configuring another one in the new version and trying whether they both work would be a go test. |
|
@smarnach Yes, exactly - what you described would be a great test. And then try getting TestShib working again by configuring it via the admin interface - (the Shibboleth configuration won't automatically migrate - only Google, Facebook, or LinkedIn will). |
|
@bradenmacdonald I can't make Google authentication work on the edx:feature/shibboleth-tpa branch. I followed the configuration instructions at http://johnmcox.blogspot.de/2014/05/getting-started-with-edx-third-party.html, but I get a 403 when trying to authenticate with Google. I then wanted to try whether this works on master, but going back to master results in this error: This is most likely related to going back to the older python-social-auth version that doesn't use migrations, but I don't know how to recover from it. Any ideas? |
|
@smarnach Hmm. Try checking out shibboleth-2, then |
|
@bradenmacdonald Thanks, reverting the migration while on shibboleth-2 worked. I already tried the same command while on master, which didn't work. (After switching to the master branch, I also had to do On master, logging in via Google works, but it doesn't work on the edx:feature/shibboleth-tpa branch, and I get a 403 deep in the python-social-auth code instead. (I can provide a traceback if desired.) Should I try a different branch as well? |
|
@bradenmacdonald I also tried the shibboleth-2 branch, and I get the same traceback, available at https://gist.github.com/smarnach/2ebfbe947128e2432b67. It occurs after the Google page that asks for permission for offline access. |
|
As discussed in IRC, the problem turned out to be that I had to enable the Google+ API in the Google developer console. The new version of python-social-auth used in the feature branch uses that API to authenticate, while the old version used some other API. |
|
With exception of the Google+ API problem mentioned above, all tests went fine. I think it would be good if you could give more detailed testing instructions for the upstream reviewers. 👍 for the code from me. |
Will that be required during deployment to edge & prod? It would be useful to prepare a checklist of things devops will need to do upon deployment, along with the rest of the django configuration setup. |
|
@antoviaque Yes, I'm tracking all of those issues in the feature branch PR: https://github.com/edx/edx-platform/pull/8140 |
|
@bradenmacdonald Perfect - thanks! |
039a607 to
3cb8dc8
Compare
3cb8dc8 to
255988b
Compare
|
@cpennington This is also now ready for your review. |
77ba27d to
f1d4bf9
Compare
b93e6a7 to
29efd21
Compare
|
Following an IRC conversation with @bradenmacdonald, it turns out that the TPA backends must appear first in AUTHENTICATION_BACKENDS (or, at least, prior to RateLimitModelBackend / django.contrib.auth.backends.ModelBackend) in order to work correctly. The expected way to do this is by setting THIRD_PARTY_AUTH_BACKENDS in aws.py, not by appending to AUTHENTICATION_BACKENDS. Otherwise, RateLimitModelBackend will raise a KeyError due to lack of a username kwarg. |
There was a problem hiding this comment.
It was a bit confusing that this looked like a ConfigurationModel, but then was actually just implemented as a raw model. Would it be easier to write it as a ConfigurationModel, but then simply not give users write permissions (so that only the pull command is actually writing to it)?
There was a problem hiding this comment.
I did actually code it that way at first (using ConfigurationModel). But of the three columns that ConfigurationModel defines, I didn't really want any of them for this model. change_date is ambiguous and has auto_now_add=True, whereas in the model I wrote here we have a fetch_date which is more clear and which gets updated to the current time during every fetch where there are no changes to the data. changed_by doesn't apply, and enabled isn't necessary since providers should be enabled/disabled via the SAMLProviderConfig model instead.
So it seemed like ConfigurationModel would add things we didn't need, and didn't provide that much in the way of functionality code for this. It is also arguably confusing to use ConfigurationModel for something that isn't "configured" by the user.
|
Some small notes, but once those are resolved, 👍 |
|
Thanks @cpennington ! If you think I should still change |
|
@bradenmacdonald: Merge away! |
New configuration for third_party_auth & shibboleth/SAML SSO
|
Thanks for the pull request, @bradenmacdonald! I've created OSPR-2182 to keep track of it in JIRA. JIRA is a place for product owners to prioritize feature reviews by the engineering development teams. Feel free to add as much of the following information to the ticket:
All technical communication about the code itself will still be done via the GitHub pull request interface. As a reminder, our process documentation is here. If you like, you can add yourself to the AUTHORS file for this repo, though that isn't required. Please see the CONTRIBUTING file for more information. |
|
@edx-webhook Thanks, though I don't think this would have been strictly necessary for a PR that was merged more than two years ago. :) |
|
Buh? ¯\_(ツ)_/¯ |
Description
This PR contains three major changes:
third_party_authto use keyed ConfigurationModels for most configuration. This has the following benefits:lms.(auth|env).jsonfiles.manage.pycommand.eduPersonEntitlement. This can be used, for example, to only allow a third party University's students to authenticate with SSO but not guests or alumni (who still have valid Shibboleth credentials from that University).This PR is against the Shibboleth/SAML SSO feature branch,
feature/shibboleth-tpa.Notes:
FEATURESflagENABLE_COMBINED_LOGIN_REGISTRATIONis true or false.Coming in the future:
manage.py saml pulltask to run via celery beatScreenshots:
New SAML Provider configuration UI:

Sandbox (Updated May 26):
There is a demo at http://sandbox5.opencraft.com/admin/third_party_auth/ - user name 'admin', ping Braden via HipChat or IRC or email for the password.
Reviewers:
Code: @smarnach, @cpennington
Test Instructions:
Provider Configuration:
Provider configuration migration:
paver update_db.SAML Configuration:
./manage.py lms saml pull --settings=devstackand verify that it worked by checking /admin/third_party_auth/samlproviderdata/