* NOTASK: PoC for loading data from Healthcare API * NOTASK: PoC for loading data from Healthcare API fix * Add sample dialog for loading test dicom-picker * Fix incorrect promise resolving * NOTASK: PoC for loading dicom store * Add web-components as git submodules. (Probably will be changed later) * Add rough dicomStore picker * Add dataset selector * NOTASK: QIDO metadata first draft * NOTASK: Not Implemented error for color images * NOTASK: clean-up * Dicom files uploader intermediate version * NOTASK: Accept header * NOTASK: docker configs * NOTASK: fix * NOTASK: howTo * Add draft of DICOM uploader * Add missing files * Fix error with missing clientId * Update submodule * NOTASK: HowTo * NOTASK: config for dev * NOTASK: new docker file * clean-up * Update GCP web-components * Add integration with async web components * Fix errors in nginx.conf * Structured reports views basic implementation * NOTASK: qido -> wado * NOTASK: config fix * NOTASK: dirty copy-paste implementation * Add "Change dicom store" button. Add an ability to clear date. Fix bug, when OAuth dosn't work if URL is not / * Fix studylist filtering * Fix dockerfile * NOTASK: meteor update * NOTASK: fix of package structure * NOTASK: merge fix * improvements Move check for now SR into SR modal Use simple button to open SR modal Remove button styling cleanup * copy SR data retrieval to wado * make search of SR simpler * Codestyle fix * NOTASK: palette color error message * Fix date filter. Fix server settings on first loading. Add SR and PS buttons * NOTASK: PS is now hidden by default * NOTASK: dirty solution * NOTASK: new wadoimage lib version * Fix PS and SR buttons * Make modal dialogs vertically centered * Update web components. Quick UI fixes * Add missing files to the previous commit * NOTASK: show-hide for PS * NOTASK: show-hide for PS * NOTASK: fix of min-max PixelValue bug * Add "sign out" functionality for Google OAuth. Update web-components. * intermediate commit * Add demo signin page * Beautifying demo sign in page * NOTASK: merge * NOTASK: clean-up * Use npm for getting healthcare-api-adapter instead of git submodule. * NOTASK: clean-up * meteor update * clean-up * clean-up * Clean up code * Update healthcare-api-adapter version. Add location to dicom store path. Fix buttons style. * Downgrade meteor and packages to master version. Use meteor-build-client-fixed2
87 lines
2.1 KiB
JavaScript
87 lines
2.1 KiB
JavaScript
import { Meteor } from 'meteor/meteor';
|
|
import { Router } from 'meteor/clinical:router';
|
|
import { OHIF } from 'meteor/ohif:core';
|
|
|
|
import oidcUserManager from './oidcUserManager.js';
|
|
|
|
/**
|
|
* Trigger a redirect to the OpenID Connect client Sign In page.
|
|
*
|
|
* @param {Object} args Arguments to UserManager.signinRedirect
|
|
* @return {Promise}
|
|
*/
|
|
function signIn(args) {
|
|
return oidcUserManager.signinRedirect(args);
|
|
}
|
|
|
|
/**
|
|
*
|
|
*/
|
|
function removeHash () {
|
|
history.pushState("", document.title, window.location.pathname
|
|
+ window.location.search);
|
|
}
|
|
|
|
|
|
/**
|
|
* Handle the response from an OpenID Connect client Sign In page.
|
|
*
|
|
* Upon completion, store the user access token in Session Storage
|
|
* for easy access from the rest of the application.
|
|
*
|
|
* @return {Promise}
|
|
*/
|
|
function processSignInResponse(redirect_uri) {
|
|
return oidcUserManager.signinRedirectCallback().then(() => {
|
|
removeHash();
|
|
});
|
|
}
|
|
|
|
/**
|
|
* Retrieve the current User from the oidc-client-js UserManager.
|
|
*
|
|
* @return {Promise}
|
|
*/
|
|
function getUser() {
|
|
return oidcUserManager.getUser();
|
|
}
|
|
|
|
/**
|
|
* Check if the current window location contains an OAuth
|
|
* sign-in response.
|
|
*
|
|
* @return {boolean} True if the URL contains an OAuth
|
|
* sign-in response (e.g. &state=...)
|
|
*/
|
|
function urlHasSignInResponse() {
|
|
const hash = window.location.hash.substring(1);
|
|
const params = {};
|
|
|
|
hash.split('&').map(hk => {
|
|
const temp = hk.split('=');
|
|
params[temp[0]] = temp[1]
|
|
});
|
|
|
|
return !!params.state;
|
|
}
|
|
|
|
Router.onRun(function() {
|
|
const isSignedIn = OHIF.user.userLoggedIn() || OHIF.demoMode && OHIF.demoMode.userLoggedIn();
|
|
const isDemoPage = OHIF.demoMode && this.url === "/demo-signin";
|
|
|
|
if (isSignedIn || isDemoPage)
|
|
this.next();
|
|
else if (urlHasSignInResponse() === true)
|
|
processSignInResponse().then(this.next);
|
|
else {
|
|
const redirect_uri = Meteor.absoluteUrl(OHIF.user.getOidcRedirectUri());
|
|
signIn({ redirect_uri });
|
|
}
|
|
});
|
|
|
|
Router.route(OHIF.user.getOidcRedirectUri(), function() {
|
|
Router.go('/', {}, { replaceState: true });
|
|
}, { name: 'oidc_redirect' });
|
|
|
|
|