Skip to content

Commit

Permalink
feat: add eventListener in Atlas for Gen3 logout event
Browse files Browse the repository at this point in the history
  • Loading branch information
pieterlukasse committed Jul 11, 2024
1 parent d61607a commit 263a77c
Showing 1 changed file with 32 additions and 1 deletion.
33 changes: 32 additions & 1 deletion kube/services/ohdsi-atlas/ohdsi-atlas-config-local.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ metadata:
name: ohdsi-atlas-config-local
data:
config-local.js: |
define([], function () {
define(['components/welcome'], function (welcome) {
var configLocal = {};
// WebAPI
configLocal.api = {
Expand Down Expand Up @@ -33,6 +33,12 @@ data:
return configLocal;
});
/////////////////////////////////////////////////////////////
// Code to post messages to Gen3 to keep the Gen3 session
// alive when the user is busy in Atlas (which is in an iframe
// inside Gen3 portal).
/////////////////////////////////////////////////////////////
var parentOfThisIframe = window.parent;
var mouseoverCount = 0;
Expand All @@ -45,3 +51,28 @@ data:
mouseoverCount = 0;
}
});
/////////////////////////////////////////////////////////////
// Code to process logout message from Gen3 portal to
// ensure the user is logged out of Atlas when clicking logout
// in Gen3 portal.
/////////////////////////////////////////////////////////////
window.addEventListener('message', this.processParentIncomingMessages);
processParentIncomingMessages = (event) => {
const host = $hostname;
const applicationBaseUrl = `https//${host}`;
// ONLY process messages coming from the same domain as the app AND
// which contain the message "logout user!":
if (
event.origin === applicationBaseUrl
&& event.data === 'logout user!'
) {
// Call function to logout user from Atlas:
welcome.signout();
}
};
// post message back acknowledging receipt and successful Atlas
// logout:
// TODO

0 comments on commit 263a77c

Please sign in to comment.