Skip to content

Commit

Permalink
Merge pull request #19251 from dannon/login-redirect-followup
Browse files Browse the repository at this point in the history
[24.2] Login redirect followup
  • Loading branch information
mvdbeek authored Dec 5, 2024
2 parents 16fe9c5 + 5f83406 commit 316ac2e
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion lib/galaxy/webapps/galaxy/controllers/authnz.py
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,10 @@ def login(self, trans, provider, idphint=None, next=None):
log.debug(msg)
return trans.show_error_message(msg)
if next:
trans.set_cookie(value=next, name=LOGIN_NEXT_COOKIE_NAME)
trans.set_cookie(value=next, name=LOGIN_NEXT_COOKIE_NAME, age=1)
else:
# If no next parameter is provided, ensure we unset any existing next cookie.
trans.set_cookie(value="/", name=LOGIN_NEXT_COOKIE_NAME)
success, message, redirect_uri = trans.app.authnz_manager.authenticate(provider, trans, idphint)
if success:
return {"redirect_uri": redirect_uri}
Expand Down Expand Up @@ -138,6 +141,8 @@ def callback(self, trans, provider, idphint=None, **kwargs):
trans.handle_user_login(user)
# Record which idp provider was logged into, so we can logout of it later
trans.set_cookie(value=provider, name=PROVIDER_COOKIE_NAME)
# Clear the login next cookie back to default.
trans.set_cookie(value="/", name=LOGIN_NEXT_COOKIE_NAME)
return trans.response.send_redirect(url_for(redirect_url))

@web.expose
Expand Down

0 comments on commit 316ac2e

Please sign in to comment.