Skip to content
Snippets Groups Projects
Commit 917300fa authored by Steinwender, Tamara's avatar Steinwender, Tamara
Browse files

Merge branch 'master' of gitlab.tugraz.at:dbp/web-components/toolkit

parents 50d5b917 437152cf
No related branches found
No related tags found
No related merge requests found
Pipeline #12940 passed
......@@ -712,7 +712,7 @@ export class AppShell extends ScopedElementsMixin(LitElement) {
return html`
<slot class="${slotClassMap}"></slot>
<dbp-auth-keycloak lang="${this.lang}" url="${kc.url}" realm="${kc.realm}" client-id="${kc.clientId}" silent-check-sso-redirect-uri="${kc.silentCheckSsoRedirectUri || ''}" scope="${kc.scope || ''}" load-person try-login></dbp-auth-keycloak>
<dbp-auth-keycloak lang="${this.lang}" url="${kc.url}" realm="${kc.realm}" client-id="${kc.clientId}" silent-check-sso-redirect-uri="${kc.silentCheckSsoRedirectUri || ''}" scope="${kc.scope || ''}" idp-hint="${kc.idpHint || ''}" load-person try-login></dbp-auth-keycloak>
<div class="${mainClassMap}">
<div id="main">
<dbp-notification lang="${this.lang}"></dbp-notification>
......
......@@ -42,6 +42,7 @@ export class AuthKeycloak extends LitElement {
this.clientId = null;
this.silentCheckSsoRedirectUri = null;
this.scope = null;
this.idpHint = '';
// Create the events
this.initEvent = new CustomEvent("dbp-auth-init", { "detail": "KeyCloak init event", bubbles: true, composed: true });
......@@ -174,6 +175,7 @@ export class AuthKeycloak extends LitElement {
clientId: { type: String, attribute: 'client-id' },
silentCheckSsoRedirectUri: { type: String, attribute: 'silent-check-sso-redirect-uri' },
scope: { type: String },
idpHint: { type: String, attribute: 'idp-hint' },
};
}
......@@ -188,7 +190,7 @@ export class AuthKeycloak extends LitElement {
throw Error("client-id not set");
this._bus = new EventBus();
this._kcwrapper = new KeycloakWrapper(this.keycloakUrl, this.realm, this.clientId, this.silentCheckSsoRedirectUri);
this._kcwrapper = new KeycloakWrapper(this.keycloakUrl, this.realm, this.clientId, this.silentCheckSsoRedirectUri, this.idpHint);
this._kcwrapper.addEventListener('changed', this._onKCChanged);
this._bus.subscribe('auth-login', () => {
......
......@@ -39,7 +39,7 @@ const ensureURL = function(urlOrPath) {
*/
export class KeycloakWrapper extends EventTarget {
constructor(baseURL, realm, clientId, silentCheckSsoUri) {
constructor(baseURL, realm, clientId, silentCheckSsoUri, idpHint) {
super();
this._baseURL = baseURL;
......@@ -48,6 +48,7 @@ export class KeycloakWrapper extends EventTarget {
this._keycloak = null;
this._initDone = false;
this._silentCheckSsoUri = silentCheckSsoUri;
this._idpHint = idpHint;
}
_onChanged() {
......@@ -105,6 +106,7 @@ export class KeycloakWrapper extends EventTarget {
async _keycloakInit(options) {
// https://gitlab.tugraz.at/dbp/apps/library/issues/41
// retry the keycloak init in case it fails, maybe it helps :/
options['idpHint'] = 'eid-oidc';
try {
return await this._keycloak.init(options);
} catch (e) {
......@@ -120,10 +122,12 @@ export class KeycloakWrapper extends EventTarget {
const options = {
promiseType: 'native',
pkceMethod: 'S256'
pkceMethod: 'S256',
};
if (this._silentCheckSsoUri) {
options['onLoad'] = 'check-sso';
options['silentCheckSsoRedirectUri'] = ensureURL(this._silentCheckSsoUri);
......@@ -136,6 +140,7 @@ export class KeycloakWrapper extends EventTarget {
} else {
await this._keycloakInit(options);
}
}
/**
......@@ -164,7 +169,9 @@ export class KeycloakWrapper extends EventTarget {
kcLocale: language, // Keycloak < 9.0
locale: language,
scope: scope,
idpHint: this._idpHint,
});
//options['idpHint'] = 'eid-oidc';
}
}
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment