Merge pull request #9150 from dannon/oidc-fixes

[20.01] Assorted OIDC fixes
This commit is contained in:
John Chilton
2020-01-07 10:24:56 -05:00
committed by GitHub
4 changed files with 10 additions and 14 deletions
@@ -40,11 +40,13 @@
</b-form>
<div v-for="idp in oidc_idps" :key="idp" style="margin:0.5em">
<span v-if="oidc_idps_icons[idp]">
<img v-bind:src="oidc_idps_icons[idp]" height="45" v-bind:alt="idp" />
<b-button variant="link" class="d-block mt-3" @click="submitOIDCLogin(idp)">
<img v-bind:src="oidc_idps_icons[idp]" height="45" v-bind:alt="idp" />
</b-button>
</span>
<span v-else>
<b-button class="d-block mt-3" @click="submitOIDCLogin(idp)">
<i v-bind:class="oidc_idps_icons[idp]" /> Sign in with
<i v-bind:class="oidc_idps[idp]" /> Sign in with
{{ idp.charAt(0).toUpperCase() + idp.slice(1) }}
</b-button>
</span>
@@ -78,20 +80,11 @@ export default {
},
data() {
const galaxy = getGalaxyInstance();
const oidc_idps = galaxy.config.oidc;
// Icons to use for each IdP
const oidc_idps_icons = {
google: "https://developers.google.com/identity/images/btn_google_signin_light_normal_web.png",
elixir: "https://elixir-europe.org/sites/default/files/images/login-button-orange.png"
};
// Add default icons to IdPs without icons
oidc_idps
.filter(function(key) {
return oidc_idps_icons[key] === undefined;
})
.forEach(function(idp) {
oidc_idps_icons[idp] = "fa fa-id-card";
});
return {
login: null,
password: null,
@@ -103,7 +96,7 @@ export default {
redirect: galaxy.params.redirect,
session_csrf_token: galaxy.session_csrf_token,
enable_oidc: galaxy.config.enable_oidc,
oidc_idps: oidc_idps,
oidc_idps: galaxy.config.oidc,
oidc_idps_icons: oidc_idps_icons
};
},
+1 -1
View File
@@ -18,7 +18,7 @@ function logoutClick() {
if (galaxy.user) {
galaxy.user.clearSessionStorage();
}
window.top.location.href = galaxy.root;
window.top.location.href = `${galaxy.root}login?logout=true`;
});
}
+2
View File
@@ -104,6 +104,8 @@ class AuthnzManager(object):
self.oidc_backends_config[idp] = self._parse_custos_config(child)
self.oidc_backends_implementation[idp] = 'custos'
self.app.config.oidc.append(idp)
else:
raise ParseError("Unknown provider specified")
if len(self.oidc_backends_config) == 0:
raise ParseError("No valid provider configuration parsed.")
except ImportError:
@@ -87,7 +87,8 @@ class RootController(controller.JSAppLauncher, UsesAnnotations):
# there is only one oidc provider, 3) auth_conf.xml has no authenticators
if (trans.app.config.enable_oidc and
len(trans.app.config.oidc) == 1 and
len(trans.app.auth_manager.authenticators) == 0):
len(trans.app.auth_manager.authenticators) == 0
and not kwd.get('logout', False)):
provider = trans.app.config.oidc[0]
success, message, redirect_uri = trans.app.authnz_manager.authenticate(provider, trans)