Skip to content
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

Revamped + Enhanced Shibboleth support #842

Merged
merged 5 commits into from
Sep 10, 2013
Merged

Revamped + Enhanced Shibboleth support #842

merged 5 commits into from
Sep 10, 2013

Conversation

jbau
Copy link

@jbau jbau commented Aug 30, 2013

  • If a shib users type in their email on the regular login page,
    redirects them to /shib-login/
  • Modify student.views.accounts_login to handle redirects
    generated by @login_required for courses that use shib for
    access control.
    Redirect those logins to /shib-login/?next=

@ormsbee @brianhw (whom I understand may be on vacation)

@@ -75,7 +80,7 @@ class ShibSPTest(ModuleStoreTestCase):
def setUp(self):
self.store = editable_modulestore()

@unittest.skipUnless(settings.MITX_FEATURES.get('AUTH_USE_SHIB'), True)
@unittest.skipUnless(settings.MITX_FEATURES.get('AUTH_USE_SHIB'), "AUTH_USE_SHIB not set")
Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Heh. The 2nd argument of skipUnless is supposed to be a reason string. Lucky happenstance that this worked before.

@jbau
Copy link
Author

jbau commented Sep 5, 2013

@brianhw can you take a look at this PR also?

self.assertIsNone(get_course_enrollment_domain(self.course.id))
self.assertEqual(self.shib_course.enrollment_domain, get_course_enrollment_domain(self.shib_course.id))

@unittest.skipUnless(settings.MITX_FEATURES.get('AUTH_USE_SHIB'), "AUTH_USE_SHIB not set")
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do any of these tests work if SHIB is not enabled? (The difference is CMS versus LMS, right?)

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No they don't. These tests are assuming LMS (which also has external_auth as an INSTALLED_APP), mainly b/c they use the LMS URL schema. They don't run under CMS because external_auth is not an INSTALLED_APP.

Actually the implicit assumption is that SHIB is only used on the LMS side, even though it's in common, again because the login/reg handler functions in external_auth/views.py assume redirects to LMS student views.
I should put a comment somewhere. Probably in envs/common.py for both LMS and CMS.

Actually a broader question. Should external_auth be in common anymore? I can see student being in common for the models, even though the views are all LMS specific, but I don't know if the same can be said for external_auth.

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

and also, the settings.MITX_FEATURES.get('AUTH_USE_SHIB') serves as a proxy for LMS vs. CMS. If there were another condition that was more directly determining LMS vs CMS tests, I might and that condition with this one.

@brianhw
Copy link
Contributor

brianhw commented Sep 5, 2013

I've made a pass, @jbau. Lots of great stuff here.

@jbau
Copy link
Author

jbau commented Sep 5, 2013

thx for your comments @brianhw
Lemme follow up as the day goes along.

"""
method_calls = mock_audit_log.method_calls
self.assertEquals(len(method_calls), 1)
Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

These changes are because I added the one log item to AUDIT_LOG in student.views.login_user. Changes this to check only the last call.

jbau added 4 commits September 6, 2013 15:36
* If a shib users type in their email on the regular login page,
  redirects them to /shib-login/
* Modify student.views.accounts_login to handle redirects
  generated by @login_required for courses that use shib for
  access control.
  Redirect those logins to /shib-login/?next=
* Fix open redirect vulnerability
* Add Logging To AUDIT_LOG : Note I had to change existing tests
  that mocked AUDIT_LOG with this
* Use external_auth.views.SHIBBOLETH_DOMAIN_PREFIX in student.views
* Add a bunch of documentation
* PEP8 / Pylint
"""
Tests util functions in shib module
"""
def test__flatten_to_ascii(self):
Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

added test for flattening to ascii.

@jbau
Copy link
Author

jbau commented Sep 9, 2013

@ormsbee also, any blockers remaining? I'd like merge instead of leaving this hanging so I can move on to other priorities. (cf. our previous discussion of using the regexp versus the return value of django.urlresolvers.resolve(), where I was that the return values of resolve() didn't reveal enough about whether a URL is in a "course" context without also relying on code conventions (like course_id being a view kwarg), to the point of testing with regxep being more reliable.)

@jbau
Copy link
Author

jbau commented Sep 10, 2013

re-ran the tests and passed, so merging.

jbau added a commit that referenced this pull request Sep 10, 2013
Revamped + Enhanced Shibboleth support
@jbau jbau merged commit f3af24f into master Sep 10, 2013
cgopalan pushed a commit to open-craft/edx-platform that referenced this pull request Aug 20, 2017
jfavellar90 added a commit to eduNEXT/edx-platform that referenced this pull request Aug 23, 2018
Upgrading rocket chat version to 0.2.16
kluo pushed a commit to kluo/edx-platform that referenced this pull request Dec 4, 2018
Repatriate test that was erroneously deleted.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants