refactor: Studio OAuth cleanup, part 1 (#28760)

- Update migration instructions
    - Changes regarding redirect URLs and cookie domain are to permit the
      site to run on multiple domains.
- Set LOGIN_URL in common so that it can be unset in environment overrides

This bypasses the "redirect to LMS" login/signup code, but does not yet
remove it; removal is covered by DEPR-166 so that this remains a
configuration-only change for now.

There should have no user-visible effect.

ref: ARCHBOM-1890
This commit is contained in:
Tim McCormack
2021-09-16 16:16:45 +00:00
committed by GitHub
parent df20c2e0ea
commit dbb473f490
4 changed files with 6 additions and 13 deletions

View File

@@ -181,7 +181,7 @@ class AuthTestCase(ContentStoreTestCase):
)
self.assertContains(
response,
'<a class="action action-signin" href="/signin_redirect_to_lms?next=http%3A%2F%2Ftestserver%2F">'
'<a class="action action-signin" href="/login/?next=http%3A%2F%2Ftestserver%2F">'
'Sign In</a>'
)

View File

@@ -647,11 +647,8 @@ LMS_INTERNAL_ROOT_URL = LMS_ROOT_URL
# Use LMS SSO for login, once enabled by setting LOGIN_URL (see docs/guides/studio_oauth.rst)
SOCIAL_AUTH_STRATEGY = 'auth_backends.strategies.EdxDjangoStrategy'
LOGIN_REDIRECT_URL = EDX_ROOT_URL + '/home/'
# TODO: Set LOGIN_URL to '/login/' after Studio OAuth transition is complete, and
# finish ARCH-1253 cleanup. See docs/guides/studio_oauth.rst
LOGIN_URL = reverse_lazy('login_redirect_to_lms')
FRONTEND_LOGIN_URL = lambda settings: settings.LMS_ROOT_URL + '/login'
derived('FRONTEND_LOGIN_URL')
LOGIN_URL = '/login/'
FRONTEND_LOGIN_URL = LOGIN_URL
# Warning: Must have trailing slash to activate correct logout view
# (auth_backends, not LMS user_authn)
FRONTEND_LOGOUT_URL = '/logout/'

View File

@@ -48,9 +48,6 @@ LMS_BASE = 'localhost:18000'
LMS_ROOT_URL = f'http://{LMS_BASE}'
FEATURES['PREVIEW_LMS_BASE'] = "preview." + LMS_BASE
# TODO: Remove after Studio OAuth transition is complete. See docs/guides/studio_oauth.rst
LOGIN_URL = '/login/'
FRONTEND_LOGIN_URL = LMS_ROOT_URL + '/login'
FRONTEND_REGISTER_URL = LMS_ROOT_URL + '/register'
########################### PIPELINE #################################