Skip to content

Fix PSU: Persistent Magento <> Open edX Login Issues #1400

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

Open
wants to merge 4 commits into
base: appsembler/psu-temp-tahoe-juniper
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 11 additions & 1 deletion openedx/core/djangoapps/user_authn/cookies.py
Original file line number Diff line number Diff line change
Expand Up @@ -257,12 +257,22 @@ def _create_and_set_jwt_cookies(response, request, cookie_settings, user=None):
if settings.FEATURES.get('DISABLE_SET_JWT_COOKIES_FOR_TESTS', False):
return

# going to set these as session cookies per PSU request.
# The Magnento code checks for edx-jwt-cookie-header-payload to determine if a learner
# is logged into the LMS. If none found, a new login_session API call is made
# Kate wants these cookies to be invalidated at browser close, in part because
# users are sharing computers.

expires_in = settings.JWT_AUTH['JWT_IN_COOKIE_EXPIRATION']
_set_expires_in_cookie_settings(cookie_settings, expires_in)
# _set_expires_in_cookie_settings(cookie_settings, expires_in)

jwt = _create_jwt(request, user, expires_in)
jwt_header_and_payload, jwt_signature = _parse_jwt(jwt)

# set a JWT cookie as session cookie
del cookie_settings['expires']
del cookie_settings['max_age']

_set_jwt_cookies(
response,
cookie_settings,
Expand Down