Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

TASK-5096 - IVA issue when logout from CAS #822

Merged
merged 8 commits into from
Oct 19, 2023
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
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
Loading