Skip to content

Commit

Permalink
Merge pull request #11584 from mvdbeek/backport_oidc_logout
Browse files Browse the repository at this point in the history
[21.01] Backport oidc logout fix
  • Loading branch information
dannon authored Mar 10, 2021
2 parents 90e4f0c + a8a581b commit 3cafcfd
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -173,6 +173,7 @@ export default {
axios
.post(`${rootUrl}authnz/${idp}/login/?idphint=${this.selected.EntityID}`)
.then((response) => {
localStorage.setItem("galaxy-provider", idp);
if (response.data.redirect_uri) {
window.location = response.data.redirect_uri;
}
Expand Down
5 changes: 5 additions & 0 deletions client/src/layout/menu.js
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,11 @@ export function userLogout(logoutAll = false) {
}
// Check if we need to logout of OIDC IDP
if (galaxy.config.enable_oidc) {
const provider = localStorage.getItem("galaxy-provider");
if (provider) {
localStorage.removeItem("galaxy-provider");
return axios.get(`${galaxy.root}authnz/logout?provider=${provider}`);
}
return axios.get(`${galaxy.root}authnz/logout`);
} else {
// Otherwise pass through the initial logout response
Expand Down
5 changes: 3 additions & 2 deletions lib/galaxy/webapps/galaxy/controllers/authnz.py
Original file line number Diff line number Diff line change
Expand Up @@ -142,6 +142,7 @@ def disconnect(self, trans, provider, email=None, **kwargs):
return trans.response.send_redirect(redirect_url)

@web.json
@web.expose
def logout(self, trans, provider, **kwargs):
post_logout_redirect_url = trans.request.base + url_for('/') + 'root/login?is_logout_redirect=true'
success, message, redirect_uri = trans.app.authnz_manager.logout(provider,
Expand All @@ -153,8 +154,8 @@ def logout(self, trans, provider, **kwargs):
return {'message': message}

@web.expose
def get_logout_url(self, trans, **kwargs):
idp_provider = trans.get_cookie(name=PROVIDER_COOKIE_NAME)
def get_logout_url(self, trans, provider=None, **kwargs):
idp_provider = provider if provider else trans.get_cookie(name=PROVIDER_COOKIE_NAME)
if idp_provider:
return trans.response.send_redirect(url_for(controller='authnz', action='logout', provider=idp_provider))

Expand Down

0 comments on commit 3cafcfd

Please sign in to comment.