Skip to content

Commit

Permalink
Merge branch 'develop' into TASK-4158
Browse files Browse the repository at this point in the history
  • Loading branch information
jmjuanes committed Oct 24, 2023
2 parents 713c603 + 63c70a0 commit d474f3d
Show file tree
Hide file tree
Showing 5 changed files with 30 additions and 21 deletions.
7 changes: 5 additions & 2 deletions src/core/clients/opencga/opencga-client.js
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,10 @@ export class OpenCGAClient {
prefix: ""
// expirationTime: ""
},
sso: false,
sso: {
active: false,
cookie: "JSESSIONID",
},
};
}

Expand All @@ -80,7 +83,7 @@ export class OpenCGAClient {
console.error(e);
// Josemi NOTE 20230324 Terrible hack to prevent displaying OpenCGA host not available error
// when iva starts, as the /meta/about is restricted when SSO is enabled
if (!this._config.sso) {
if (!this._config?.sso?.active) {
globalEvent("signingInError", {value: "Opencga host not available."});
globalEvent("hostInit", {host: "opencga", value: "NOT AVAILABLE"});
}
Expand Down
6 changes: 3 additions & 3 deletions src/core/clients/opencga/opencga-parent-class.js
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ export default class OpenCGAParentClass {
}

// Enable credentials
_options.includeCredentials = !!this._config.sso;
_options.includeCredentials = !!this._config?.sso?.active;

// console.log(`OpenCGA client calling to ${url}`);
// if the URL query fails we try with next host
Expand Down Expand Up @@ -83,7 +83,7 @@ export default class OpenCGAParentClass {
}

// Enable credentials
_options.includeCredentials = !!this._config.sso;
_options.includeCredentials = !!this._config?.sso?.active;

return this.restClient.call(url, _options, k);
}
Expand All @@ -106,7 +106,7 @@ export default class OpenCGAParentClass {
// _options.body = _params.body;

// Enable credentials
_options.includeCredentials = !!this._config.sso;
_options.includeCredentials = !!this._config?.sso?.active;

return this.restClient.call(url, _options, k);
}
Expand Down
9 changes: 6 additions & 3 deletions src/sites/iva/iva-app.js
Original file line number Diff line number Diff line change
Expand Up @@ -381,7 +381,10 @@ class IvaApp extends LitElement {
active: true,
prefix: opencgaPrefix,
},
sso: opencgaSsoActive,
sso: {
active: opencgaSsoActive,
cookie: opencgaSsoCookie,
},
});

this.reactomeClient = new ReactomeClient();
Expand Down Expand Up @@ -638,9 +641,9 @@ class IvaApp extends LitElement {
await this.opencgaClient.logout();

// Check if sso is active: we will redirect to 'meta/sso/logout' endpoint
if (this.opencgaClient?._config?.sso) {
if (this.opencgaClient?._config?.sso?.active) {
// eslint-disable-next-line no-undef
Cookies.expire("JSESSIONID");
Cookies.expire(this.opencgaClient._config.sso.cookie);

const config = this.opencgaClient._config;
const ivaUrl = window.location;
Expand Down
1 change: 1 addition & 0 deletions src/webcomponents/commons/forms/select-token-filter.js
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,7 @@ export default class SelectTokenFilter extends LitElement {
firstUpdated() {
this.select = $("#" + this._prefix);
this.select.select2({
dropdownParent: document.querySelector(`#${this._prefix}`).parentElement,
separator: this._config.separator ?? [","],
tags: this._config.freeTag ?? true,
multiple: this._config.multiple ?? true,
Expand Down
28 changes: 15 additions & 13 deletions src/webcomponents/commons/layouts/custom-landing.js
Original file line number Diff line number Diff line change
Expand Up @@ -242,20 +242,22 @@ export default class CustomLanding extends LitElement {
` : null}
<!-- Landing login -->
<div class="landing-login">
${this.opencgaSession?.opencgaClient?._config?.sso ? html`
${this.opencgaSession?.opencgaClient?._config?.sso?.active ? html`
<div>
<a class="btn-group" role="group" href="${this.getSSOUrl()}">
<button type="button" class="btn btn-primary btn-lg" style="">
<i class="fas fa-user"></i>
</button>
<button type="button" class="btn btn-primary btn-lg">
<strong style="color:white;">Login with SSO</strong>
</button>
</a>
</div>
<div class="landing-login-sso-helper">
By clicking on the <b>Login with SSO</b> button you will be redirected to your SSO login
page.
<div align="center">
<a class="btn-group" role="group" href="${this.getSSOUrl()}">
<button type="button" class="btn btn-primary btn-lg" style="">
<i class="fas fa-user"></i>
</button>
<button type="button" class="btn btn-primary btn-lg">
<strong style="color:white;">Login with SSO</strong>
</button>
</a>
</div>
<div class="landing-login-sso-helper">
By clicking on the <b>Login with SSO</b> button you will be redirected to your SSO login
page.
</div>
</div>
` : html`
<user-login
Expand Down

0 comments on commit d474f3d

Please sign in to comment.