Commit b77bff4d by Sven Marnach

Small fixes to support Okta SSO.

parent 3d087d5c
......@@ -150,7 +150,7 @@ logger = getLogger(__name__)
class AuthEntryError(AuthException):
"""Raised when auth_entry is missing or invalid on URLs.
"""Raised when auth_entry is invalid on URLs.
auth_entry tells us whether the auth flow was initiated to register a new
user (in which case it has the value of AUTH_ENTRY_REGISTER) or log in an
......@@ -459,10 +459,11 @@ def running(request):
def parse_query_params(strategy, response, *args, **kwargs):
"""Reads whitelisted query params, transforms them into pipeline args."""
auth_entry = strategy.request.session.get(AUTH_ENTRY_KEY)
if not (auth_entry and auth_entry in _AUTH_ENTRY_CHOICES):
raise AuthEntryError(strategy.request.backend, 'auth_entry missing or invalid')
# If auth_entry is not in the session, we got here by a non-standard workflow.
# We simply assume 'login' in that case.
auth_entry = strategy.request.session.get(AUTH_ENTRY_KEY, AUTH_ENTRY_LOGIN)
if auth_entry not in _AUTH_ENTRY_CHOICES:
raise AuthEntryError(strategy.request.backend, 'auth_entry invalid')
return {'auth_entry': auth_entry}
......
......@@ -929,11 +929,10 @@ class IntegrationTest(testutil.TestCase, test.TestCase):
with self.assertRaises(pipeline.AuthEntryError):
strategy.request.backend.auth_complete = mock.MagicMock(return_value=self.fake_auth_complete(strategy))
def test_pipeline_raises_auth_entry_error_if_auth_entry_missing(self):
def test_pipeline_assumes_login_if_auth_entry_missing(self):
_, strategy = self.get_request_and_strategy(auth_entry=None, redirect_uri='social:complete')
with self.assertRaises(pipeline.AuthEntryError):
strategy.request.backend.auth_complete = mock.MagicMock(return_value=self.fake_auth_complete(strategy))
response = self.fake_auth_complete(strategy)
self.assertEqual(response.url, reverse('signin_user'))
# pylint: disable=test-inherits-tests, abstract-method
......
......@@ -95,7 +95,7 @@
if (this.autoSubmit) {
$(this.el).hide();
$('#register-honor_code').prop('checked', true);
$('#register-honor_code, #register-terms_of_service').prop('checked', true);
this.submitForm();
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment