feat(google-cloud): Add support for Google Cloud Healthcare API DICOM Store Switch (#325)
* 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
This commit is contained in:
1 parent
1783351f57
commit
9486522552
68 files changed
+1422
-514
No files matched your search
@@ -16,20 +16,29 @@ const oidcClient = oidc[0];
|
||||
const redirect_uri = Meteor.absoluteUrl(oidcClient.authRedirectUri);
|
||||
const silent_redirect_uri = Meteor.absoluteUrl('/packages/ohif_user-oidc/public/silent-refresh.html');
|
||||
|
||||
function httpGetSync(theUrl)
|
||||
{
|
||||
// TODO: consider making it async somehow
|
||||
var xmlHttp = new XMLHttpRequest();
|
||||
xmlHttp.open( "GET", theUrl, false ); // false for synchronous request
|
||||
xmlHttp.send( null );
|
||||
return xmlHttp.responseText;
|
||||
}
|
||||
|
||||
const id = oidcClient.clientId || httpGetSync( Meteor.absoluteUrl('/gcloud-client-id'));
|
||||
const settings = {
|
||||
authority: oidcClient.authServerUrl,
|
||||
client_id: oidcClient.clientId,
|
||||
client_id: id,
|
||||
redirect_uri,
|
||||
silent_redirect_uri,
|
||||
post_logout_redirect_uri: Meteor.absoluteUrl(oidcClient.postLogoutRedirectUri),
|
||||
response_type: oidcClient.responseType || 'id_token token',
|
||||
scope: oidc.scope || 'email profile openid', // Note: Request must have scope 'openid' to be considered an OpenID Connect request
|
||||
scope: oidcClient.scope || 'email profile openid https://www.googleapis.com/auth/cloud-platform.read-only https://www.googleapis.com/auth/cloud-healthcare', // seems like scope is not loaded from settings Note: Request must have scope 'openid' to be considered an OpenID Connect request
|
||||
automaticSilentRenew: true,
|
||||
revokeAccessTokenOnSignout: true,
|
||||
};
|
||||
|
||||
const itemName = `oidc.user:${oidcClient.authServerUrl}:${oidcClient.clientId}`;
|
||||
const itemName = `oidc.user:${oidcClient.authServerUrl}:${id}`;
|
||||
|
||||
function getTokenFromStorage() {
|
||||
const userDataJSON = sessionStorage.getItem(itemName);
|
||||
@@ -46,12 +55,34 @@ OHIF.user.getAccessToken = function oidcGetAccessToken() {
|
||||
if (!OHIF.user.userLoggedIn) {
|
||||
throw new Error('User is not logged in.');
|
||||
}
|
||||
|
||||
return getTokenFromStorage();
|
||||
};
|
||||
|
||||
OHIF.user.getOidcStorageKey = function () {
|
||||
return itemName;
|
||||
}
|
||||
|
||||
OHIF.user.getOidcRedirectUri = function () {
|
||||
return oidcClient.authRedirectUri;
|
||||
}
|
||||
|
||||
OHIF.user.login = function oidcLogin() {
|
||||
oidcUserManager.signinRedirect({redirect_uri});
|
||||
}
|
||||
|
||||
OHIF.user.logout = function oidcLogout() {
|
||||
oidcUserManager.signoutRedirect();
|
||||
const config = JSON.parse(sessionStorage.getItem(itemName) || null);
|
||||
if (oidcClient.revokeUrl && config && config.access_token) {
|
||||
// OIDC from Google doesn't support signing out for some reason
|
||||
// so we revoke the token manually
|
||||
sessionStorage.removeItem(itemName);
|
||||
const revokeUrl = oidcClient.revokeUrl + config.access_token;
|
||||
fetch(revokeUrl).catch(()=>{}).then(() => location.assign(oidcClient.postLogoutRedirectUri || '/'));
|
||||
|
||||
} else {
|
||||
// simple oidc signout behavior
|
||||
oidcUserManager.signoutRedirect();
|
||||
}
|
||||
}
|
||||
|
||||
OHIF.user.userLoggedIn = () => !!getTokenFromStorage();
|
||||
@@ -70,7 +101,7 @@ function handleSilentRenewError(error) {
|
||||
}
|
||||
|
||||
oidcUserManager.events.addSilentRenewError(handleSilentRenewError);
|
||||
|
||||
oidcUserManager.startSilentRenew();
|
||||
oidcUserManager.events.addAccessTokenExpired(function(){
|
||||
OHIF.user.logout();
|
||||
});
|
||||
|
||||
@@ -66,14 +66,21 @@ function urlHasSignInResponse() {
|
||||
}
|
||||
|
||||
Router.onRun(function() {
|
||||
const next = this.next;
|
||||
const redirect_uri = Meteor.absoluteUrl(this.request.url);
|
||||
const isSignedIn = OHIF.user.userLoggedIn() || OHIF.demoMode && OHIF.demoMode.userLoggedIn();
|
||||
const isDemoPage = OHIF.demoMode && this.url === "/demo-signin";
|
||||
|
||||
if (OHIF.user.userLoggedIn()) {
|
||||
next()
|
||||
} else if (urlHasSignInResponse() === true) {
|
||||
processSignInResponse().then(next);
|
||||
} else {
|
||||
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' });
|
||||
|
||||
|
||||
Reference in new issue
Block a user