feat(openid-connect): Switch to generic OIDC Client library instead of using Keycloak.js (#273)
This commit is contained in:
parent
2f05ed5961
commit
18bcf83805
@ -47,8 +47,8 @@ ohif:metadata
|
||||
|
||||
# Necessary for Lesion Trakcer
|
||||
ohif:lesiontracker
|
||||
ohif:user
|
||||
ohif:user-management
|
||||
ohif:user-meteor-accounts
|
||||
ohif:select-tree
|
||||
|
||||
accounts-base@1.4.2
|
||||
|
||||
@ -108,8 +108,8 @@ ohif:studies@0.0.1
|
||||
ohif:study-list@0.0.1
|
||||
ohif:themes@0.0.1
|
||||
ohif:themes-common@0.0.1
|
||||
ohif:user@0.0.1
|
||||
ohif:user-management@0.0.1
|
||||
ohif:user-meteor-accounts@0.0.1
|
||||
ohif:viewerbase@0.0.1
|
||||
ohif:wadoproxy@0.0.1
|
||||
ordered-dict@1.1.0
|
||||
|
||||
@ -25,9 +25,6 @@ reactive-var@1.0.11
|
||||
reactive-dict@1.2.0
|
||||
standard-minifier-css@1.4.1
|
||||
standard-minifier-js@2.3.4
|
||||
accounts-base
|
||||
accounts-oauth
|
||||
oauth-encryption
|
||||
|
||||
# OHIF Packages
|
||||
ohif:polyfill
|
||||
@ -44,8 +41,7 @@ ohif:dicom-services
|
||||
ohif:dicomweb-client
|
||||
ohif:hanging-protocols
|
||||
ohif:metadata
|
||||
ohif:user
|
||||
ohif:user-keycloak
|
||||
ohif:user-oidc
|
||||
ohif:measurement-table
|
||||
|
||||
fortawesome:fontawesome
|
||||
|
||||
@ -1,6 +1,3 @@
|
||||
accounts-base@1.4.2
|
||||
accounts-oauth@1.1.15
|
||||
accounts-password@1.5.1
|
||||
aldeed:collection2@2.10.0
|
||||
aldeed:collection2-core@1.2.0
|
||||
aldeed:schema-deny@1.1.0
|
||||
@ -30,7 +27,6 @@ cultofcoders:persistent-session@0.4.5
|
||||
ddp@1.4.0
|
||||
ddp-client@2.3.3
|
||||
ddp-common@1.4.0
|
||||
ddp-rate-limiter@1.0.7
|
||||
ddp-server@2.2.0
|
||||
deps@1.0.12
|
||||
diff-sequence@1.1.0
|
||||
@ -40,7 +36,6 @@ ecmascript-runtime@0.7.0
|
||||
ecmascript-runtime-client@0.7.1
|
||||
ecmascript-runtime-server@0.7.0
|
||||
ejson@1.1.0
|
||||
email@1.2.3
|
||||
es5-shim@4.8.0
|
||||
fastclick@1.0.13
|
||||
fortawesome:fontawesome@4.7.0
|
||||
@ -59,7 +54,6 @@ jquery@1.11.11
|
||||
launch-screen@1.1.1
|
||||
livedata@1.0.18
|
||||
lmieulet:meteor-coverage@1.1.4
|
||||
localstorage@1.2.0
|
||||
logging@1.1.20
|
||||
mdg:validation-error@0.5.1
|
||||
meteor@1.9.2
|
||||
@ -80,15 +74,8 @@ momentjs:moment@2.22.2
|
||||
mongo@1.5.1
|
||||
mongo-dev-server@1.1.0
|
||||
mongo-id@1.0.7
|
||||
mxab:accounts-keycloak@0.0.2
|
||||
mxab:keycloak-loader@0.0.2
|
||||
mxab:keycloak-oauth@0.0.2
|
||||
natestrauser:select2@4.0.3
|
||||
npm-bcrypt@0.9.3
|
||||
npm-mongo@3.0.7
|
||||
oauth@1.2.3
|
||||
oauth-encryption@1.3.0
|
||||
oauth2@1.2.0
|
||||
observe-sequence@1.0.16
|
||||
ohif:commands@0.0.1
|
||||
ohif:core@0.0.1
|
||||
@ -111,8 +98,7 @@ ohif:studies@0.0.1
|
||||
ohif:study-list@0.0.1
|
||||
ohif:themes@0.0.1
|
||||
ohif:themes-common@0.0.1
|
||||
ohif:user@0.0.1
|
||||
ohif:user-keycloak@0.0.1
|
||||
ohif:user-oidc@0.0.1
|
||||
ohif:viewerbase@0.0.1
|
||||
ohif:wadoproxy@0.0.1
|
||||
ordered-dict@1.1.0
|
||||
@ -120,21 +106,17 @@ practicalmeteor:mocha-core@1.0.1
|
||||
promise@0.11.1
|
||||
raix:eventemitter@0.1.3
|
||||
random@1.1.0
|
||||
rate-limit@1.0.9
|
||||
reactive-dict@1.2.0
|
||||
reactive-var@1.0.11
|
||||
reload@1.2.0
|
||||
retry@1.1.0
|
||||
routepolicy@1.0.13
|
||||
service-configuration@1.0.11
|
||||
session@1.1.7
|
||||
sha@1.0.9
|
||||
shell-server@0.3.1
|
||||
silentcicero:jszip@0.0.4
|
||||
socket-stream-client@0.2.2
|
||||
spacebars@1.0.15
|
||||
spacebars-compiler@1.1.3
|
||||
srp@1.0.10
|
||||
standard-app-packages@1.0.9
|
||||
standard-minifier-css@1.4.1
|
||||
standard-minifier-js@2.3.4
|
||||
|
||||
@ -31,7 +31,7 @@ Template.ohifViewer.onCreated(() => {
|
||||
icon: 'fa fa-info'
|
||||
}];
|
||||
|
||||
if (Meteor.user()) {
|
||||
if (OHIF.user.userLoggedIn() === true) {
|
||||
headerItems.push({
|
||||
action: OHIF.user.logout,
|
||||
text: 'Logout',
|
||||
|
||||
@ -32,7 +32,7 @@ body>.header
|
||||
.menu-toggle
|
||||
display: inline-block
|
||||
height: 18px
|
||||
|
||||
|
||||
.research-use
|
||||
font-size: 13px
|
||||
theme('color', '$textSecondaryColor')
|
||||
@ -62,7 +62,6 @@ body>.header
|
||||
|
||||
.brand
|
||||
height: 100%
|
||||
width: 80%
|
||||
line-height: $topBarExpandedHeight - 10px
|
||||
|
||||
.logo-image
|
||||
|
||||
@ -1,7 +1,6 @@
|
||||
import { Meteor } from 'meteor/meteor';
|
||||
import { OHIF } from 'meteor/ohif:core';
|
||||
import { cornerstoneWADOImageLoader } from 'meteor/ohif:cornerstone';
|
||||
import { Accounts } from "meteor/accounts-base";
|
||||
|
||||
Meteor.startup(function() {
|
||||
const maxWebWorkers = Math.max(navigator.hardwareConcurrency - 1, 1);
|
||||
@ -23,17 +22,10 @@ Meteor.startup(function() {
|
||||
|
||||
cornerstoneWADOImageLoader.configure({
|
||||
beforeSend: function(xhr) {
|
||||
const userId = Meteor.userId();
|
||||
const accessToken = OHIF.user.getAccessToken();
|
||||
|
||||
if (accessToken) {
|
||||
xhr.setRequestHeader("Authorization", `Bearer ${accessToken}`);
|
||||
} else {
|
||||
const loginToken = Accounts._storedLoginToken();
|
||||
if (userId && loginToken) {
|
||||
xhr.setRequestHeader("x-user-id", userId);
|
||||
xhr.setRequestHeader("x-auth-token", loginToken);
|
||||
}
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
@ -5,12 +5,21 @@ Router.configure({
|
||||
layoutTemplate: 'layout',
|
||||
});
|
||||
|
||||
Router.waitOn(function() {
|
||||
return [
|
||||
Meteor.subscribe('servers'),
|
||||
Meteor.subscribe('currentServer')
|
||||
];
|
||||
});
|
||||
|
||||
// If we are running a disconnect client similar to the StandaloneViewer
|
||||
// (see https://docs.ohif.org/standalone-viewer/usage.html) we don't want
|
||||
// our routes to get stuck while waiting for Pub / Sub.
|
||||
//
|
||||
// In this case, the developer is required to add Servers and specify
|
||||
// a CurrentServer with some other approach (e.g. a separate script).
|
||||
if (Meteor.status().connected === true) {
|
||||
Router.waitOn(function() {
|
||||
return [
|
||||
Meteor.subscribe('servers'),
|
||||
Meteor.subscribe('currentServer')
|
||||
];
|
||||
});
|
||||
}
|
||||
|
||||
Router.onBeforeAction('loading');
|
||||
|
||||
|
||||
383
OHIFViewer/package-lock.json
generated
383
OHIFViewer/package-lock.json
generated
@ -13,11 +13,6 @@
|
||||
"regenerator-runtime": "^0.11.1"
|
||||
}
|
||||
},
|
||||
"abbrev": {
|
||||
"version": "1.1.1",
|
||||
"resolved": "https://registry.npmjs.org/abbrev/-/abbrev-1.1.1.tgz",
|
||||
"integrity": "sha512-nne9/IiQ/hzIhY6pdDnbBtz7DjPTKrY00P/zvPSm5pOFkl6xuGrGnXn/VtTNNfNtAfZ9/1RtehkszU9qcTii0Q=="
|
||||
},
|
||||
"agent-base": {
|
||||
"version": "4.2.1",
|
||||
"resolved": "https://registry.npmjs.org/agent-base/-/agent-base-4.2.1.tgz",
|
||||
@ -27,25 +22,6 @@
|
||||
"es6-promisify": "^5.0.0"
|
||||
}
|
||||
},
|
||||
"ansi-regex": {
|
||||
"version": "2.1.1",
|
||||
"resolved": "https://registry.npmjs.org/ansi-regex/-/ansi-regex-2.1.1.tgz",
|
||||
"integrity": "sha1-w7M6te42DYbg5ijwRorn7yfWVN8="
|
||||
},
|
||||
"aproba": {
|
||||
"version": "1.2.0",
|
||||
"resolved": "https://registry.npmjs.org/aproba/-/aproba-1.2.0.tgz",
|
||||
"integrity": "sha512-Y9J6ZjXtoYh8RnXVCMOU/ttDmk1aBjunq9vO0ta5x85WDQiQfUF9sIPBITdbiiIVcBo03Hi3jMxigBtsddlXRw=="
|
||||
},
|
||||
"are-we-there-yet": {
|
||||
"version": "1.1.5",
|
||||
"resolved": "https://registry.npmjs.org/are-we-there-yet/-/are-we-there-yet-1.1.5.tgz",
|
||||
"integrity": "sha512-5hYdAkZlcG8tOLujVDTgCT+uPX0VnpAH28gWsLfzpXYm7wP6mp5Q/gYyR7YQ0cKVJcXJnl3j2kpBan13PtQf6w==",
|
||||
"requires": {
|
||||
"delegates": "^1.0.0",
|
||||
"readable-stream": "^2.0.6"
|
||||
}
|
||||
},
|
||||
"async-limiter": {
|
||||
"version": "1.0.0",
|
||||
"resolved": "https://registry.npmjs.org/async-limiter/-/async-limiter-1.0.0.tgz",
|
||||
@ -55,21 +31,14 @@
|
||||
"balanced-match": {
|
||||
"version": "1.0.0",
|
||||
"resolved": "https://registry.npmjs.org/balanced-match/-/balanced-match-1.0.0.tgz",
|
||||
"integrity": "sha1-ibTRmasr7kneFk6gK4nORi1xt2c="
|
||||
},
|
||||
"bcrypt": {
|
||||
"version": "2.0.0",
|
||||
"resolved": "https://registry.npmjs.org/bcrypt/-/bcrypt-2.0.0.tgz",
|
||||
"integrity": "sha512-KL3nXU8H6QR/dgSUWHkjId5xIOJn8DTl4idFl720nsBwoq5ArAqIVmZ5BbD8LiCH+wjS7NX9hBvp30rGMmU0LA==",
|
||||
"requires": {
|
||||
"nan": "2.10.0",
|
||||
"node-pre-gyp": "0.9.0"
|
||||
}
|
||||
"integrity": "sha1-ibTRmasr7kneFk6gK4nORi1xt2c=",
|
||||
"dev": true
|
||||
},
|
||||
"brace-expansion": {
|
||||
"version": "1.1.11",
|
||||
"resolved": "https://registry.npmjs.org/brace-expansion/-/brace-expansion-1.1.11.tgz",
|
||||
"integrity": "sha512-iCuPHDFgrHX7H2vEI/5xpz07zSHB00TpugqhmYtVmMO6518mCuRMoOYFldEBl0g187ufozdaHgWKcYFb61qGiA==",
|
||||
"dev": true,
|
||||
"requires": {
|
||||
"balanced-match": "^1.0.0",
|
||||
"concat-map": "0.0.1"
|
||||
@ -81,20 +50,11 @@
|
||||
"integrity": "sha512-c5mRlguI/Pe2dSZmpER62rSCu0ryKmWddzRYsuXc50U2/g8jMOulc31VZMa4mYx31U5xsmSOpDCgH88Vl9cDGQ==",
|
||||
"dev": true
|
||||
},
|
||||
"chownr": {
|
||||
"version": "1.0.1",
|
||||
"resolved": "https://registry.npmjs.org/chownr/-/chownr-1.0.1.tgz",
|
||||
"integrity": "sha1-4qdQQqlVGQi+vSW4Uj1fl2nXkYE="
|
||||
},
|
||||
"code-point-at": {
|
||||
"version": "1.1.0",
|
||||
"resolved": "https://registry.npmjs.org/code-point-at/-/code-point-at-1.1.0.tgz",
|
||||
"integrity": "sha1-DQcLTQQ6W+ozovGkDi7bPZpMz3c="
|
||||
},
|
||||
"concat-map": {
|
||||
"version": "0.0.1",
|
||||
"resolved": "https://registry.npmjs.org/concat-map/-/concat-map-0.0.1.tgz",
|
||||
"integrity": "sha1-2Klr13/Wjfd5OnMDajug1UBdR3s="
|
||||
"integrity": "sha1-2Klr13/Wjfd5OnMDajug1UBdR3s=",
|
||||
"dev": true
|
||||
},
|
||||
"concat-stream": {
|
||||
"version": "1.6.2",
|
||||
@ -108,11 +68,6 @@
|
||||
"typedarray": "^0.0.6"
|
||||
}
|
||||
},
|
||||
"console-control-strings": {
|
||||
"version": "1.1.0",
|
||||
"resolved": "https://registry.npmjs.org/console-control-strings/-/console-control-strings-1.1.0.tgz",
|
||||
"integrity": "sha1-PXz0Rk22RG6mRL9LOVB/mFEAjo4="
|
||||
},
|
||||
"core-js": {
|
||||
"version": "2.5.7",
|
||||
"resolved": "https://registry.npmjs.org/core-js/-/core-js-2.5.7.tgz",
|
||||
@ -121,7 +76,8 @@
|
||||
"core-util-is": {
|
||||
"version": "1.0.2",
|
||||
"resolved": "https://registry.npmjs.org/core-util-is/-/core-util-is-1.0.2.tgz",
|
||||
"integrity": "sha1-tf1UIgqivFq1eqtxQMlAdUUDwac="
|
||||
"integrity": "sha1-tf1UIgqivFq1eqtxQMlAdUUDwac=",
|
||||
"dev": true
|
||||
},
|
||||
"debug": {
|
||||
"version": "3.1.0",
|
||||
@ -132,21 +88,6 @@
|
||||
"ms": "2.0.0"
|
||||
}
|
||||
},
|
||||
"deep-extend": {
|
||||
"version": "0.6.0",
|
||||
"resolved": "https://registry.npmjs.org/deep-extend/-/deep-extend-0.6.0.tgz",
|
||||
"integrity": "sha512-LOHxIOaPYdHlJRtCQfDIVZtfw/ufM8+rVj649RIHzcm/vGwQRXFt6OPqIFWsm2XEMrNIEtWR64sY1LEKD2vAOA=="
|
||||
},
|
||||
"delegates": {
|
||||
"version": "1.0.0",
|
||||
"resolved": "https://registry.npmjs.org/delegates/-/delegates-1.0.0.tgz",
|
||||
"integrity": "sha1-hMbhWbgZBP3KWaDvRM2HDTElD5o="
|
||||
},
|
||||
"detect-libc": {
|
||||
"version": "1.0.3",
|
||||
"resolved": "https://registry.npmjs.org/detect-libc/-/detect-libc-1.0.3.tgz",
|
||||
"integrity": "sha1-+hN8S9aY7fVc1c0CrFWfkaTEups="
|
||||
},
|
||||
"es6-promise": {
|
||||
"version": "4.2.4",
|
||||
"resolved": "https://registry.npmjs.org/es6-promise/-/es6-promise-4.2.4.tgz",
|
||||
@ -194,38 +135,17 @@
|
||||
"pend": "~1.2.0"
|
||||
}
|
||||
},
|
||||
"fs-minipass": {
|
||||
"version": "1.2.5",
|
||||
"resolved": "https://registry.npmjs.org/fs-minipass/-/fs-minipass-1.2.5.tgz",
|
||||
"integrity": "sha512-JhBl0skXjUPCFH7x6x61gQxrKyXsxB5gcgePLZCwfyCGGsTISMoIeObbrvVeP6Xmyaudw4TT43qV2Gz+iyd2oQ==",
|
||||
"requires": {
|
||||
"minipass": "^2.2.1"
|
||||
}
|
||||
},
|
||||
"fs.realpath": {
|
||||
"version": "1.0.0",
|
||||
"resolved": "https://registry.npmjs.org/fs.realpath/-/fs.realpath-1.0.0.tgz",
|
||||
"integrity": "sha1-FQStJSMVjKpA20onh8sBQRmU6k8="
|
||||
},
|
||||
"gauge": {
|
||||
"version": "2.7.4",
|
||||
"resolved": "https://registry.npmjs.org/gauge/-/gauge-2.7.4.tgz",
|
||||
"integrity": "sha1-LANAXHU4w51+s3sxcCLjJfsBi/c=",
|
||||
"requires": {
|
||||
"aproba": "^1.0.3",
|
||||
"console-control-strings": "^1.0.0",
|
||||
"has-unicode": "^2.0.0",
|
||||
"object-assign": "^4.1.0",
|
||||
"signal-exit": "^3.0.0",
|
||||
"string-width": "^1.0.1",
|
||||
"strip-ansi": "^3.0.1",
|
||||
"wide-align": "^1.1.0"
|
||||
}
|
||||
"integrity": "sha1-FQStJSMVjKpA20onh8sBQRmU6k8=",
|
||||
"dev": true
|
||||
},
|
||||
"glob": {
|
||||
"version": "7.1.2",
|
||||
"resolved": "https://registry.npmjs.org/glob/-/glob-7.1.2.tgz",
|
||||
"integrity": "sha512-MJTUg1kjuLeQCJ+ccE4Vpa6kKVXkPYJ2mOCQyUuKLcLQsdrMCpBPUi8qVE6+YuaJkozeA9NusTAw3hLr8Xe5EQ==",
|
||||
"dev": true,
|
||||
"requires": {
|
||||
"fs.realpath": "^1.0.0",
|
||||
"inflight": "^1.0.4",
|
||||
@ -235,11 +155,6 @@
|
||||
"path-is-absolute": "^1.0.0"
|
||||
}
|
||||
},
|
||||
"has-unicode": {
|
||||
"version": "2.0.1",
|
||||
"resolved": "https://registry.npmjs.org/has-unicode/-/has-unicode-2.0.1.tgz",
|
||||
"integrity": "sha1-4Ob+aijPUROIVeCG0Wkedx3iqLk="
|
||||
},
|
||||
"https-proxy-agent": {
|
||||
"version": "2.2.1",
|
||||
"resolved": "https://registry.npmjs.org/https-proxy-agent/-/https-proxy-agent-2.2.1.tgz",
|
||||
@ -250,26 +165,11 @@
|
||||
"debug": "^3.1.0"
|
||||
}
|
||||
},
|
||||
"iconv-lite": {
|
||||
"version": "0.4.23",
|
||||
"resolved": "https://registry.npmjs.org/iconv-lite/-/iconv-lite-0.4.23.tgz",
|
||||
"integrity": "sha512-neyTUVFtahjf0mB3dZT77u+8O0QB89jFdnBkd5P1JgYPbPaia3gXXOVL2fq8VyU2gMMD7SaN7QukTB/pmXYvDA==",
|
||||
"requires": {
|
||||
"safer-buffer": ">= 2.1.2 < 3"
|
||||
}
|
||||
},
|
||||
"ignore-walk": {
|
||||
"version": "3.0.1",
|
||||
"resolved": "https://registry.npmjs.org/ignore-walk/-/ignore-walk-3.0.1.tgz",
|
||||
"integrity": "sha512-DTVlMx3IYPe0/JJcYP7Gxg7ttZZu3IInhuEhbchuqneY9wWe5Ojy2mXLBaQFUQmo0AW2r3qG7m1mg86js+gnlQ==",
|
||||
"requires": {
|
||||
"minimatch": "^3.0.4"
|
||||
}
|
||||
},
|
||||
"inflight": {
|
||||
"version": "1.0.6",
|
||||
"resolved": "https://registry.npmjs.org/inflight/-/inflight-1.0.6.tgz",
|
||||
"integrity": "sha1-Sb1jMdfQLQwJvJEKEHW6gWW1bfk=",
|
||||
"dev": true,
|
||||
"requires": {
|
||||
"once": "^1.3.0",
|
||||
"wrappy": "1"
|
||||
@ -278,25 +178,14 @@
|
||||
"inherits": {
|
||||
"version": "2.0.3",
|
||||
"resolved": "https://registry.npmjs.org/inherits/-/inherits-2.0.3.tgz",
|
||||
"integrity": "sha1-Yzwsg+PaQqUC9SRmAiSA9CCCYd4="
|
||||
},
|
||||
"ini": {
|
||||
"version": "1.3.5",
|
||||
"resolved": "https://registry.npmjs.org/ini/-/ini-1.3.5.tgz",
|
||||
"integrity": "sha512-RZY5huIKCMRWDUqZlEi72f/lmXKMvuszcMBduliQ3nnWbx9X/ZBQO7DijMEYS9EhHBb2qacRUMtC7svLwe0lcw=="
|
||||
},
|
||||
"is-fullwidth-code-point": {
|
||||
"version": "1.0.0",
|
||||
"resolved": "https://registry.npmjs.org/is-fullwidth-code-point/-/is-fullwidth-code-point-1.0.0.tgz",
|
||||
"integrity": "sha1-754xOG8DGn8NZDr4L95QxFfvAMs=",
|
||||
"requires": {
|
||||
"number-is-nan": "^1.0.0"
|
||||
}
|
||||
"integrity": "sha1-Yzwsg+PaQqUC9SRmAiSA9CCCYd4=",
|
||||
"dev": true
|
||||
},
|
||||
"isarray": {
|
||||
"version": "1.0.0",
|
||||
"resolved": "https://registry.npmjs.org/isarray/-/isarray-1.0.0.tgz",
|
||||
"integrity": "sha1-u5NdSFgsuhaMBoNJV6VKPgcSTxE="
|
||||
"integrity": "sha1-u5NdSFgsuhaMBoNJV6VKPgcSTxE=",
|
||||
"dev": true
|
||||
},
|
||||
"loglevel": {
|
||||
"version": "1.6.1",
|
||||
@ -313,6 +202,7 @@
|
||||
"version": "3.0.4",
|
||||
"resolved": "https://registry.npmjs.org/minimatch/-/minimatch-3.0.4.tgz",
|
||||
"integrity": "sha512-yJHVQEhyqPLUTgt9B83PXu6W3rx4MvvHvSUvToogpwoGDOUQ+yDrR0HRot+yOCdCO7u4hX3pWft6kWBBcqh0UA==",
|
||||
"dev": true,
|
||||
"requires": {
|
||||
"brace-expansion": "^1.1.7"
|
||||
}
|
||||
@ -320,29 +210,14 @@
|
||||
"minimist": {
|
||||
"version": "0.0.8",
|
||||
"resolved": "https://registry.npmjs.org/minimist/-/minimist-0.0.8.tgz",
|
||||
"integrity": "sha1-hX/Kv8M5fSYluCKCYuhqp6ARsF0="
|
||||
},
|
||||
"minipass": {
|
||||
"version": "2.3.3",
|
||||
"resolved": "https://registry.npmjs.org/minipass/-/minipass-2.3.3.tgz",
|
||||
"integrity": "sha512-/jAn9/tEX4gnpyRATxgHEOV6xbcyxgT7iUnxo9Y3+OB0zX00TgKIv/2FZCf5brBbICcwbLqVv2ImjvWWrQMSYw==",
|
||||
"requires": {
|
||||
"safe-buffer": "^5.1.2",
|
||||
"yallist": "^3.0.0"
|
||||
}
|
||||
},
|
||||
"minizlib": {
|
||||
"version": "1.1.0",
|
||||
"resolved": "https://registry.npmjs.org/minizlib/-/minizlib-1.1.0.tgz",
|
||||
"integrity": "sha512-4T6Ur/GctZ27nHfpt9THOdRZNgyJ9FZchYO1ceg5S8Q3DNLCKYy44nCZzgCJgcvx2UM8czmqak5BCxJMrq37lA==",
|
||||
"requires": {
|
||||
"minipass": "^2.2.1"
|
||||
}
|
||||
"integrity": "sha1-hX/Kv8M5fSYluCKCYuhqp6ARsF0=",
|
||||
"dev": true
|
||||
},
|
||||
"mkdirp": {
|
||||
"version": "0.5.1",
|
||||
"resolved": "https://registry.npmjs.org/mkdirp/-/mkdirp-0.5.1.tgz",
|
||||
"integrity": "sha1-MAV0OOrGz3+MR2fzhkjWaX11yQM=",
|
||||
"dev": true,
|
||||
"requires": {
|
||||
"minimist": "0.0.8"
|
||||
}
|
||||
@ -350,125 +225,23 @@
|
||||
"ms": {
|
||||
"version": "2.0.0",
|
||||
"resolved": "https://registry.npmjs.org/ms/-/ms-2.0.0.tgz",
|
||||
"integrity": "sha1-VgiurfwAvmwpAd9fmGF4jeDVl8g="
|
||||
},
|
||||
"nan": {
|
||||
"version": "2.10.0",
|
||||
"resolved": "https://registry.npmjs.org/nan/-/nan-2.10.0.tgz",
|
||||
"integrity": "sha512-bAdJv7fBLhWC+/Bls0Oza+mvTaNQtP+1RyhhhvD95pgUJz6XM5IzgmxOkItJ9tkoCiplvAnXI1tNmmUD/eScyA=="
|
||||
},
|
||||
"needle": {
|
||||
"version": "2.2.1",
|
||||
"resolved": "https://registry.npmjs.org/needle/-/needle-2.2.1.tgz",
|
||||
"integrity": "sha512-t/ZswCM9JTWjAdXS9VpvqhI2Ct2sL2MdY4fUXqGJaGBk13ge99ObqRksRTbBE56K+wxUXwwfZYOuZHifFW9q+Q==",
|
||||
"requires": {
|
||||
"debug": "^2.1.2",
|
||||
"iconv-lite": "^0.4.4",
|
||||
"sax": "^1.2.4"
|
||||
},
|
||||
"dependencies": {
|
||||
"debug": {
|
||||
"version": "2.6.9",
|
||||
"resolved": "https://registry.npmjs.org/debug/-/debug-2.6.9.tgz",
|
||||
"integrity": "sha512-bC7ElrdJaJnPbAP+1EotYvqZsb3ecl5wi6Bfi6BJTUcNowp6cvspg0jXznRTKDjm/E7AdgFBVeAPVMNcKGsHMA==",
|
||||
"requires": {
|
||||
"ms": "2.0.0"
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
"node-pre-gyp": {
|
||||
"version": "0.9.0",
|
||||
"resolved": "https://registry.npmjs.org/node-pre-gyp/-/node-pre-gyp-0.9.0.tgz",
|
||||
"integrity": "sha1-vdTDr6ybGx6/8Kn/M2KFnrZ4G7g=",
|
||||
"requires": {
|
||||
"detect-libc": "^1.0.2",
|
||||
"mkdirp": "^0.5.1",
|
||||
"needle": "^2.2.0",
|
||||
"nopt": "^4.0.1",
|
||||
"npm-packlist": "^1.1.6",
|
||||
"npmlog": "^4.0.2",
|
||||
"rc": "^1.1.7",
|
||||
"rimraf": "^2.6.1",
|
||||
"semver": "^5.3.0",
|
||||
"tar": "^4"
|
||||
}
|
||||
},
|
||||
"nopt": {
|
||||
"version": "4.0.1",
|
||||
"resolved": "https://registry.npmjs.org/nopt/-/nopt-4.0.1.tgz",
|
||||
"integrity": "sha1-0NRoWv1UFRk8jHUFYC0NF81kR00=",
|
||||
"requires": {
|
||||
"abbrev": "1",
|
||||
"osenv": "^0.1.4"
|
||||
}
|
||||
},
|
||||
"npm-bundled": {
|
||||
"version": "1.0.3",
|
||||
"resolved": "https://registry.npmjs.org/npm-bundled/-/npm-bundled-1.0.3.tgz",
|
||||
"integrity": "sha512-ByQ3oJ/5ETLyglU2+8dBObvhfWXX8dtPZDMePCahptliFX2iIuhyEszyFk401PZUNQH20vvdW5MLjJxkwU80Ow=="
|
||||
},
|
||||
"npm-packlist": {
|
||||
"version": "1.1.11",
|
||||
"resolved": "https://registry.npmjs.org/npm-packlist/-/npm-packlist-1.1.11.tgz",
|
||||
"integrity": "sha512-CxKlZ24urLkJk+9kCm48RTQ7L4hsmgSVzEk0TLGPzzyuFxD7VNgy5Sl24tOLMzQv773a/NeJ1ce1DKeacqffEA==",
|
||||
"requires": {
|
||||
"ignore-walk": "^3.0.1",
|
||||
"npm-bundled": "^1.0.1"
|
||||
}
|
||||
},
|
||||
"npmlog": {
|
||||
"version": "4.1.2",
|
||||
"resolved": "https://registry.npmjs.org/npmlog/-/npmlog-4.1.2.tgz",
|
||||
"integrity": "sha512-2uUqazuKlTaSI/dC8AzicUck7+IrEaOnN/e0jd3Xtt1KcGpwx30v50mL7oPyr/h9bL3E4aZccVwpwP+5W9Vjkg==",
|
||||
"requires": {
|
||||
"are-we-there-yet": "~1.1.2",
|
||||
"console-control-strings": "~1.1.0",
|
||||
"gauge": "~2.7.3",
|
||||
"set-blocking": "~2.0.0"
|
||||
}
|
||||
},
|
||||
"number-is-nan": {
|
||||
"version": "1.0.1",
|
||||
"resolved": "https://registry.npmjs.org/number-is-nan/-/number-is-nan-1.0.1.tgz",
|
||||
"integrity": "sha1-CXtgK1NCKlIsGvuHkDGDNpQaAR0="
|
||||
},
|
||||
"object-assign": {
|
||||
"version": "4.1.1",
|
||||
"resolved": "https://registry.npmjs.org/object-assign/-/object-assign-4.1.1.tgz",
|
||||
"integrity": "sha1-IQmtx5ZYh8/AXLvUQsrIv7s2CGM="
|
||||
"integrity": "sha1-VgiurfwAvmwpAd9fmGF4jeDVl8g=",
|
||||
"dev": true
|
||||
},
|
||||
"once": {
|
||||
"version": "1.4.0",
|
||||
"resolved": "https://registry.npmjs.org/once/-/once-1.4.0.tgz",
|
||||
"integrity": "sha1-WDsap3WWHUsROsF9nFC6753Xa9E=",
|
||||
"dev": true,
|
||||
"requires": {
|
||||
"wrappy": "1"
|
||||
}
|
||||
},
|
||||
"os-homedir": {
|
||||
"version": "1.0.2",
|
||||
"resolved": "https://registry.npmjs.org/os-homedir/-/os-homedir-1.0.2.tgz",
|
||||
"integrity": "sha1-/7xJiDNuDoM94MFox+8VISGqf7M="
|
||||
},
|
||||
"os-tmpdir": {
|
||||
"version": "1.0.2",
|
||||
"resolved": "https://registry.npmjs.org/os-tmpdir/-/os-tmpdir-1.0.2.tgz",
|
||||
"integrity": "sha1-u+Z0BseaqFxc/sdm/lc0VV36EnQ="
|
||||
},
|
||||
"osenv": {
|
||||
"version": "0.1.5",
|
||||
"resolved": "https://registry.npmjs.org/osenv/-/osenv-0.1.5.tgz",
|
||||
"integrity": "sha512-0CWcCECdMVc2Rw3U5w9ZjqX6ga6ubk1xDVKxtBQPK7wis/0F2r9T6k4ydGYhecl7YUBxBVxhL5oisPsNxAPe2g==",
|
||||
"requires": {
|
||||
"os-homedir": "^1.0.0",
|
||||
"os-tmpdir": "^1.0.0"
|
||||
}
|
||||
},
|
||||
"path-is-absolute": {
|
||||
"version": "1.0.1",
|
||||
"resolved": "https://registry.npmjs.org/path-is-absolute/-/path-is-absolute-1.0.1.tgz",
|
||||
"integrity": "sha1-F0uSaHNVNP+8es5r9TpanhtcX18="
|
||||
"integrity": "sha1-F0uSaHNVNP+8es5r9TpanhtcX18=",
|
||||
"dev": true
|
||||
},
|
||||
"pend": {
|
||||
"version": "1.2.0",
|
||||
@ -479,7 +252,8 @@
|
||||
"process-nextick-args": {
|
||||
"version": "2.0.0",
|
||||
"resolved": "https://registry.npmjs.org/process-nextick-args/-/process-nextick-args-2.0.0.tgz",
|
||||
"integrity": "sha512-MtEC1TqN0EU5nephaJ4rAtThHtC86dNN9qCuEhtshvpVBkAW5ZO7BASN9REnF9eoXGcRub+pFuKEpOHE+HbEMw=="
|
||||
"integrity": "sha512-MtEC1TqN0EU5nephaJ4rAtThHtC86dNN9qCuEhtshvpVBkAW5ZO7BASN9REnF9eoXGcRub+pFuKEpOHE+HbEMw==",
|
||||
"dev": true
|
||||
},
|
||||
"progress": {
|
||||
"version": "2.0.0",
|
||||
@ -509,28 +283,11 @@
|
||||
"ws": "^5.1.1"
|
||||
}
|
||||
},
|
||||
"rc": {
|
||||
"version": "1.2.8",
|
||||
"resolved": "https://registry.npmjs.org/rc/-/rc-1.2.8.tgz",
|
||||
"integrity": "sha512-y3bGgqKj3QBdxLbLkomlohkvsA8gdAiUQlSBJnBhfn+BPxg4bc62d8TcBW15wavDfgexCgccckhcZvywyQYPOw==",
|
||||
"requires": {
|
||||
"deep-extend": "^0.6.0",
|
||||
"ini": "~1.3.0",
|
||||
"minimist": "^1.2.0",
|
||||
"strip-json-comments": "~2.0.1"
|
||||
},
|
||||
"dependencies": {
|
||||
"minimist": {
|
||||
"version": "1.2.0",
|
||||
"resolved": "https://registry.npmjs.org/minimist/-/minimist-1.2.0.tgz",
|
||||
"integrity": "sha1-o1AIsg9BOD7sH7kU9M1d95omQoQ="
|
||||
}
|
||||
}
|
||||
},
|
||||
"readable-stream": {
|
||||
"version": "2.3.6",
|
||||
"resolved": "https://registry.npmjs.org/readable-stream/-/readable-stream-2.3.6.tgz",
|
||||
"integrity": "sha512-tQtKA9WIAhBF3+VLAseyMqZeBjW0AHJoxOtYqSUZNJxauErmLbVm2FW1y+J/YA9dUrAC39ITejlZWhVIwawkKw==",
|
||||
"dev": true,
|
||||
"requires": {
|
||||
"core-util-is": "~1.0.0",
|
||||
"inherits": "~2.0.3",
|
||||
@ -550,6 +307,7 @@
|
||||
"version": "2.6.2",
|
||||
"resolved": "https://registry.npmjs.org/rimraf/-/rimraf-2.6.2.tgz",
|
||||
"integrity": "sha512-lreewLK/BlghmxtfH36YYVg1i8IAce4TI7oao75I1g245+6BctqTVQiBP3YUJ9C6DQOXJmkYR9X9fCLtCOJc5w==",
|
||||
"dev": true,
|
||||
"requires": {
|
||||
"glob": "^7.0.5"
|
||||
}
|
||||
@ -557,78 +315,18 @@
|
||||
"safe-buffer": {
|
||||
"version": "5.1.2",
|
||||
"resolved": "https://registry.npmjs.org/safe-buffer/-/safe-buffer-5.1.2.tgz",
|
||||
"integrity": "sha512-Gd2UZBJDkXlY7GbJxfsE8/nvKkUEU1G38c1siN6QP6a9PT9MmHB8GnpscSmMJSoF8LOIrt8ud/wPtojys4G6+g=="
|
||||
},
|
||||
"safer-buffer": {
|
||||
"version": "2.1.2",
|
||||
"resolved": "https://registry.npmjs.org/safer-buffer/-/safer-buffer-2.1.2.tgz",
|
||||
"integrity": "sha512-YZo3K82SD7Riyi0E1EQPojLz7kpepnSQI9IyPbHHg1XXXevb5dJI7tpyN2ADxGcQbHG7vcyRHk0cbwqcQriUtg=="
|
||||
},
|
||||
"sax": {
|
||||
"version": "1.2.4",
|
||||
"resolved": "https://registry.npmjs.org/sax/-/sax-1.2.4.tgz",
|
||||
"integrity": "sha512-NqVDv9TpANUjFm0N8uM5GxL36UgKi9/atZw+x7YFnQ8ckwFGKrl4xX4yWtrey3UJm5nP1kUbnYgLopqWNSRhWw=="
|
||||
},
|
||||
"semver": {
|
||||
"version": "5.5.0",
|
||||
"resolved": "https://registry.npmjs.org/semver/-/semver-5.5.0.tgz",
|
||||
"integrity": "sha512-4SJ3dm0WAwWy/NVeioZh5AntkdJoWKxHxcmyP622fOkgHa4z3R0TdBJICINyaSDE6uNwVc8gZr+ZinwZAH4xIA=="
|
||||
},
|
||||
"set-blocking": {
|
||||
"version": "2.0.0",
|
||||
"resolved": "https://registry.npmjs.org/set-blocking/-/set-blocking-2.0.0.tgz",
|
||||
"integrity": "sha1-BF+XgtARrppoA93TgrJDkrPYkPc="
|
||||
},
|
||||
"signal-exit": {
|
||||
"version": "3.0.2",
|
||||
"resolved": "https://registry.npmjs.org/signal-exit/-/signal-exit-3.0.2.tgz",
|
||||
"integrity": "sha1-tf3AjxKH6hF4Yo5BXiUTK3NkbG0="
|
||||
},
|
||||
"string-width": {
|
||||
"version": "1.0.2",
|
||||
"resolved": "https://registry.npmjs.org/string-width/-/string-width-1.0.2.tgz",
|
||||
"integrity": "sha1-EYvfW4zcUaKn5w0hHgfisLmxB9M=",
|
||||
"requires": {
|
||||
"code-point-at": "^1.0.0",
|
||||
"is-fullwidth-code-point": "^1.0.0",
|
||||
"strip-ansi": "^3.0.0"
|
||||
}
|
||||
"integrity": "sha512-Gd2UZBJDkXlY7GbJxfsE8/nvKkUEU1G38c1siN6QP6a9PT9MmHB8GnpscSmMJSoF8LOIrt8ud/wPtojys4G6+g==",
|
||||
"dev": true
|
||||
},
|
||||
"string_decoder": {
|
||||
"version": "1.1.1",
|
||||
"resolved": "https://registry.npmjs.org/string_decoder/-/string_decoder-1.1.1.tgz",
|
||||
"integrity": "sha512-n/ShnvDi6FHbbVfviro+WojiFzv+s8MPMHBczVePfUpDJLwoLT0ht1l4YwBCbi8pJAveEEdnkHyPyTP/mzRfwg==",
|
||||
"dev": true,
|
||||
"requires": {
|
||||
"safe-buffer": "~5.1.0"
|
||||
}
|
||||
},
|
||||
"strip-ansi": {
|
||||
"version": "3.0.1",
|
||||
"resolved": "https://registry.npmjs.org/strip-ansi/-/strip-ansi-3.0.1.tgz",
|
||||
"integrity": "sha1-ajhfuIU9lS1f8F0Oiq+UJ43GPc8=",
|
||||
"requires": {
|
||||
"ansi-regex": "^2.0.0"
|
||||
}
|
||||
},
|
||||
"strip-json-comments": {
|
||||
"version": "2.0.1",
|
||||
"resolved": "https://registry.npmjs.org/strip-json-comments/-/strip-json-comments-2.0.1.tgz",
|
||||
"integrity": "sha1-PFMZQukIwml8DsNEhYwobHygpgo="
|
||||
},
|
||||
"tar": {
|
||||
"version": "4.4.6",
|
||||
"resolved": "https://registry.npmjs.org/tar/-/tar-4.4.6.tgz",
|
||||
"integrity": "sha512-tMkTnh9EdzxyfW+6GK6fCahagXsnYk6kE6S9Gr9pjVdys769+laCTbodXDhPAjzVtEBazRgP0gYqOjnk9dQzLg==",
|
||||
"requires": {
|
||||
"chownr": "^1.0.1",
|
||||
"fs-minipass": "^1.2.5",
|
||||
"minipass": "^2.3.3",
|
||||
"minizlib": "^1.1.0",
|
||||
"mkdirp": "^0.5.0",
|
||||
"safe-buffer": "^5.1.2",
|
||||
"yallist": "^3.0.2"
|
||||
}
|
||||
},
|
||||
"typedarray": {
|
||||
"version": "0.0.6",
|
||||
"resolved": "https://registry.npmjs.org/typedarray/-/typedarray-0.0.6.tgz",
|
||||
@ -638,20 +336,14 @@
|
||||
"util-deprecate": {
|
||||
"version": "1.0.2",
|
||||
"resolved": "https://registry.npmjs.org/util-deprecate/-/util-deprecate-1.0.2.tgz",
|
||||
"integrity": "sha1-RQ1Nyfpw3nMnYvvS1KKJgUGaDM8="
|
||||
},
|
||||
"wide-align": {
|
||||
"version": "1.1.3",
|
||||
"resolved": "https://registry.npmjs.org/wide-align/-/wide-align-1.1.3.tgz",
|
||||
"integrity": "sha512-QGkOQc8XL6Bt5PwnsExKBPuMKBxnGxWWW3fU55Xt4feHozMUhdUMaBCk290qpm/wG5u/RSKzwdAC4i51YigihA==",
|
||||
"requires": {
|
||||
"string-width": "^1.0.2 || 2"
|
||||
}
|
||||
"integrity": "sha1-RQ1Nyfpw3nMnYvvS1KKJgUGaDM8=",
|
||||
"dev": true
|
||||
},
|
||||
"wrappy": {
|
||||
"version": "1.0.2",
|
||||
"resolved": "https://registry.npmjs.org/wrappy/-/wrappy-1.0.2.tgz",
|
||||
"integrity": "sha1-tSQ9jz7BqjXxNkYFvA0QNuMKtp8="
|
||||
"integrity": "sha1-tSQ9jz7BqjXxNkYFvA0QNuMKtp8=",
|
||||
"dev": true
|
||||
},
|
||||
"ws": {
|
||||
"version": "5.2.2",
|
||||
@ -662,11 +354,6 @@
|
||||
"async-limiter": "~1.0.0"
|
||||
}
|
||||
},
|
||||
"yallist": {
|
||||
"version": "3.0.2",
|
||||
"resolved": "https://registry.npmjs.org/yallist/-/yallist-3.0.2.tgz",
|
||||
"integrity": "sha1-hFK0u36Dx8GI2AQcGoN8dz1ti7k="
|
||||
},
|
||||
"yauzl": {
|
||||
"version": "2.4.1",
|
||||
"resolved": "https://registry.npmjs.org/yauzl/-/yauzl-2.4.1.tgz",
|
||||
|
||||
@ -5,7 +5,6 @@
|
||||
"main": "index.js",
|
||||
"dependencies": {
|
||||
"@babel/runtime": "7.0.0-beta.51",
|
||||
"bcrypt": "^2.0.0",
|
||||
"loglevel": "^1.6.1"
|
||||
},
|
||||
"devDependencies": {
|
||||
|
||||
@ -4,3 +4,4 @@ import './string.js';
|
||||
import './ui.js';
|
||||
import './utils.js';
|
||||
import './viewer.js';
|
||||
import './user.js';
|
||||
|
||||
16
Packages/ohif-core/client/lib/user.js
Normal file
16
Packages/ohif-core/client/lib/user.js
Normal file
@ -0,0 +1,16 @@
|
||||
import { Meteor } from 'meteor/meteor';
|
||||
import { OHIF } from 'meteor/ohif:core';
|
||||
|
||||
OHIF.user = OHIF.user || {};
|
||||
|
||||
// These should be overridden by the implementation
|
||||
OHIF.user.schema = null;
|
||||
OHIF.user.userLoggedIn = () => false;
|
||||
OHIF.user.getUserId = () => null;
|
||||
OHIF.user.getName = () => null;
|
||||
OHIF.user.getAccessToken = () => null;
|
||||
OHIF.user.login = () => new Promise((resolve, reject) => reject());
|
||||
OHIF.user.logout = () => new Promise((resolve, reject) => reject());
|
||||
OHIF.user.getData = (key) => null;
|
||||
OHIF.user.setData = (key, value) => null;
|
||||
OHIF.user.validate = () => null;
|
||||
@ -9,7 +9,8 @@ const OHIF = {
|
||||
ui: {},
|
||||
utils: {},
|
||||
viewer: {},
|
||||
cornerstone: {}
|
||||
cornerstone: {},
|
||||
user: {},
|
||||
};
|
||||
|
||||
// Expose the OHIF object to the client if it is on development mode
|
||||
|
||||
@ -42,9 +42,6 @@ Package.onUse(function(api) {
|
||||
// Client imports and routes
|
||||
api.addFiles('client/index.js', 'client');
|
||||
|
||||
// Server imports and methods
|
||||
api.addFiles('server/index.js', 'server');
|
||||
|
||||
// Client and server imports
|
||||
api.addFiles('both/index.js', ['client', 'server']);
|
||||
|
||||
|
||||
@ -1 +0,0 @@
|
||||
import './mongo.js';
|
||||
@ -1,7 +1,14 @@
|
||||
import { OHIF } from 'meteor/ohif:core';
|
||||
|
||||
export default function getAccessToken() {
|
||||
if (!global.window || !window.sessionStorage || !sessionStorage) {
|
||||
return;
|
||||
}
|
||||
|
||||
const userAccessToken = OHIF.user.getAccessToken();
|
||||
if (userAccessToken) {
|
||||
return userAccessToken;
|
||||
}
|
||||
|
||||
return sessionStorage.token;
|
||||
}
|
||||
|
||||
@ -1,5 +1,6 @@
|
||||
import { Meteor } from 'meteor/meteor';
|
||||
import { Random } from 'meteor/random';
|
||||
import { OHIF } from 'meteor/ohif:core';
|
||||
|
||||
// Local imports
|
||||
import { removeFromArray } from '../lib/removeFromArray';
|
||||
@ -39,9 +40,9 @@ HP.Protocol = class Protocol {
|
||||
|
||||
// If we are logged in while creating this Protocol,
|
||||
// store this information as well
|
||||
if (Meteor.users && Meteor.userId) {
|
||||
this.createdBy = Meteor.userId;
|
||||
this.modifiedBy = Meteor.userId;
|
||||
if (OHIF.user && OHIF.user.userLoggedIn && OHIF.user.userLoggedIn()) {
|
||||
this.createdBy = OHIF.user.getUserId();
|
||||
this.modifiedBy = OHIF.user.getUserId();
|
||||
}
|
||||
|
||||
// Create two empty Sets specifying which roles
|
||||
@ -107,8 +108,8 @@ HP.Protocol = class Protocol {
|
||||
protocolWasModified() {
|
||||
// If we are logged in while modifying this Protocol,
|
||||
// store this information as well
|
||||
if (Meteor.users && Meteor.userId) {
|
||||
this.modifiedBy = Meteor.userId;
|
||||
if (OHIF.user && OHIF.user.userLoggedIn && OHIF.user.userLoggedIn()) {
|
||||
this.modifiedBy = OHIF.user.getUserId();
|
||||
}
|
||||
|
||||
// Protocol has been modified, so mark priors information
|
||||
@ -240,4 +241,4 @@ HP.Protocol = class Protocol {
|
||||
this.protocolWasModified();
|
||||
}
|
||||
}
|
||||
};
|
||||
};
|
||||
|
||||
@ -157,4 +157,155 @@ var defaultStrategy = (function () {
|
||||
|
||||
})();
|
||||
|
||||
HP.ProtocolStore.setStrategy(defaultStrategy);
|
||||
var clientOnlyStrategy = (function () {
|
||||
const HangingProtocols = new Mongo.Collection(null);
|
||||
|
||||
let defaultsAdded = false;
|
||||
|
||||
function addDefaultProtocols() {
|
||||
console.log('Inserting default protocols');
|
||||
|
||||
addProtocol(HP.defaultProtocol);
|
||||
|
||||
defaultsAdded = true;
|
||||
}
|
||||
|
||||
function getDatabaseIdByProtocolId(protocolId) {
|
||||
const filteredProtocol = HangingProtocols.findOne({
|
||||
id: protocolId
|
||||
}, {
|
||||
fields: {
|
||||
_id: true
|
||||
}
|
||||
});
|
||||
|
||||
if (!filteredProtocol) {
|
||||
return;
|
||||
}
|
||||
|
||||
return filteredProtocol._id;
|
||||
}
|
||||
|
||||
/**
|
||||
* Registers a function to be called when the hangingprotocols collection is subscribed
|
||||
* The callback is called only one time when the subscription is ready
|
||||
*
|
||||
* @param callback The function to be called as a callback
|
||||
*/
|
||||
function onReady(callback) {
|
||||
if (!defaultsAdded) {
|
||||
addDefaultProtocols();
|
||||
}
|
||||
|
||||
callback();
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the hanging protocol by protocolId if defined, otherwise all stored hanging protocols
|
||||
*
|
||||
* @param protocolId The protocol ID used to find the hanging protocol
|
||||
* @returns {object|array} The hanging protocol by protocolId or array of the stored hanging protocols
|
||||
*/
|
||||
function getProtocol(protocolId) {
|
||||
// Return the hanging protocol by protocolId if defined
|
||||
if (protocolId) {
|
||||
return HangingProtocols.findOne({
|
||||
id: protocolId
|
||||
});
|
||||
}
|
||||
|
||||
// Otherwise, return all protocols
|
||||
return HangingProtocols.find().fetch();
|
||||
}
|
||||
|
||||
/**
|
||||
* Stores the hanging protocol
|
||||
*
|
||||
* @param protocol The hanging protocol to be stored
|
||||
*/
|
||||
function addProtocol(protocol) {
|
||||
// Collections can only be updated by database ID (_id) on client, so
|
||||
// get the database ID (_id) by the hanging protocol ID firstly
|
||||
const databaseId = getDatabaseIdByProtocolId(protocol.id);
|
||||
|
||||
// Remove any MongoDB ID the protocol may have had
|
||||
delete protocol._id;
|
||||
|
||||
// Update the protocol with the same id if exists instead of inserting this protocol
|
||||
if (databaseId) {
|
||||
// Update the hanging protocol by the database ID
|
||||
HangingProtocols.update(databaseId, {
|
||||
$set: protocol
|
||||
});
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
// Insert the protocol
|
||||
HangingProtocols.insert(protocol);
|
||||
}
|
||||
|
||||
/**
|
||||
* Updates the hanging protocol by protocolId
|
||||
*
|
||||
* @param protocolId The protocol ID used to find the hanging protocol to update
|
||||
* @param protocol The updated hanging protocol
|
||||
*/
|
||||
function updateProtocol(protocolId, protocol) {
|
||||
// Collections can only be updated by database ID (_id) on client, so
|
||||
// get the database ID (_id) by the hanging protocol ID firstly
|
||||
const databaseId = getDatabaseIdByProtocolId(protocolId);
|
||||
|
||||
// Skip if it does not exist in database
|
||||
if (!databaseId) {
|
||||
return;
|
||||
}
|
||||
|
||||
// Remove any MongoDB ID the protocol may have had
|
||||
delete protocol._id;
|
||||
|
||||
// Update the hanging protocol by the database ID
|
||||
HangingProtocols.update(databaseId, {
|
||||
$set: protocol
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Removes the hanging protocol
|
||||
*
|
||||
* @param protocolId The protocol ID used to remove the hanging protocol
|
||||
*/
|
||||
function removeProtocol(protocolId) {
|
||||
// Collections can only be removed by database ID (_id) on client, so
|
||||
// get the database ID (_id) by the hanging protocol ID firstly
|
||||
const databaseId = getDatabaseIdByProtocolId(protocolId);
|
||||
|
||||
// Skip if it does not exist in database
|
||||
if (!databaseId) {
|
||||
return;
|
||||
}
|
||||
|
||||
// Remove the hanging protocol by the database ID
|
||||
HangingProtocols.remove(databaseId);
|
||||
}
|
||||
|
||||
// Module Exports
|
||||
return {
|
||||
onReady: onReady,
|
||||
getProtocol: getProtocol,
|
||||
addProtocol: addProtocol,
|
||||
updateProtocol: updateProtocol,
|
||||
removeProtocol: removeProtocol
|
||||
};
|
||||
|
||||
})();
|
||||
|
||||
// If we are running a disconnect client similar to the StandaloneViewer
|
||||
// (see https://docs.ohif.org/standalone-viewer/usage.html) we don't want
|
||||
// our HangingProtocol strategy to try to use Meteor methods or Pub / Sub
|
||||
if (Meteor.status().connected === true) {
|
||||
HP.ProtocolStore.setStrategy(defaultStrategy);
|
||||
} else {
|
||||
HP.ProtocolStore.setStrategy(clientOnlyStrategy);
|
||||
}
|
||||
|
||||
|
||||
@ -19,6 +19,7 @@ Package.onUse(function(api) {
|
||||
api.use('validatejs');
|
||||
|
||||
// Our custom packages
|
||||
api.use('ohif:core');
|
||||
api.use('ohif:viewerbase');
|
||||
|
||||
api.addAssets('assets/dots.svg', 'client');
|
||||
|
||||
@ -130,8 +130,8 @@ Template.dialogStudyAssociation.onCreated(() => {
|
||||
// Log
|
||||
hipaaEvent = {
|
||||
eventType: hipaaEventType,
|
||||
userId: Meteor.userId(),
|
||||
userName: Meteor.user().profile.fullName,
|
||||
userId: OHIF.user.getUserId(),
|
||||
userName: OHIF.user.getName(),
|
||||
collectionName: 'Timepoints',
|
||||
recordId: timepointId,
|
||||
patientId: relatedStudies[0].patientId,
|
||||
|
||||
@ -22,13 +22,13 @@ export default function ({ instance, eventData, tool, toolGroupId, toolGroup })
|
||||
const measurement = {
|
||||
toolType: tool.parentTool,
|
||||
measurementNumber: measurementData.measurementNumber,
|
||||
userId: Meteor.userId(),
|
||||
userId: OHIF.user.getUserId(),
|
||||
patientId: imageAttributes.patientId,
|
||||
studyInstanceUid: imageAttributes.studyInstanceUid
|
||||
};
|
||||
|
||||
const additionalProperties = _.extend(imageAttributes, {
|
||||
userId: Meteor.userId()
|
||||
userId: OHIF.user.getUserId()
|
||||
});
|
||||
|
||||
const childMeasurement = _.extend({}, measurementData, additionalProperties);
|
||||
|
||||
@ -21,7 +21,7 @@ export default function ({ instance, eventData, tool }) {
|
||||
const imageAttributes = getImageAttributes(eventData.element);
|
||||
const measurement = _.extend({}, measurementData, imageAttributes, {
|
||||
measurementNumber: measurementData.measurementNumber,
|
||||
userId: Meteor.userId()
|
||||
userId: OHIF.user.getUserId()
|
||||
});
|
||||
|
||||
// Get the related timepoint by the measurement number and use its location if defined
|
||||
|
||||
@ -32,11 +32,14 @@ OHIF.studies.loadStudy = studyInstanceUid => new Promise((resolve, reject) => {
|
||||
}
|
||||
|
||||
return OHIF.studies.retrieveStudyMetadata(studyInstanceUid).then(study => {
|
||||
if (window.HipaaLogger && Meteor.user && Meteor.user()) {
|
||||
if (window.HipaaLogger &&
|
||||
OHIF.user &&
|
||||
OHIF.user.userLoggedIn &&
|
||||
OHIF.user.userLoggedIn()) {
|
||||
window.HipaaLogger.logEvent({
|
||||
eventType: 'viewed',
|
||||
userId: Meteor.userId(),
|
||||
userName: Meteor.user().profile.fullName,
|
||||
userId: OHIF.user.getUserId(),
|
||||
userName: OHIF.user.getName(),
|
||||
collectionName: 'Study',
|
||||
recordId: studyInstanceUid,
|
||||
patientId: study.patientId,
|
||||
|
||||
@ -14,17 +14,16 @@ Package.onUse(function(api) {
|
||||
|
||||
api.use('ecmascript');
|
||||
api.use('standard-app-packages');
|
||||
api.use('jquery');
|
||||
api.use('stylus');
|
||||
api.use('http');
|
||||
api.use('random');
|
||||
api.use('silentcicero:jszip');
|
||||
api.use('jquery', 'client');
|
||||
api.use('stylus', 'client');
|
||||
api.use('http', 'client');
|
||||
api.use('random', 'client');
|
||||
api.use('silentcicero:jszip', 'client');
|
||||
api.use('aldeed:simple-schema');
|
||||
api.use('accounts-base');
|
||||
api.use('aldeed:collection2');
|
||||
|
||||
// Note: MomentJS appears to be required for Bootstrap3 Datepicker, but not a dependency for some reason
|
||||
api.use('momentjs:moment');
|
||||
api.use('momentjs:moment', 'client');
|
||||
|
||||
// Our custom packages
|
||||
api.use('ohif:design');
|
||||
|
||||
@ -1,10 +0,0 @@
|
||||
import { Meteor } from 'meteor/meteor';
|
||||
|
||||
if (!Meteor.settings.public ||
|
||||
!Meteor.settings.public.custom ||
|
||||
!Meteor.settings.public.custom.keycloak) {
|
||||
|
||||
console.log('To use the ohif-user-keycloak package, you must add relevant Keycloak settings to Meteor.settings.public.custom.keycloak (client-side).');
|
||||
} else {
|
||||
require('../imports/client/index.js')
|
||||
}
|
||||
@ -1,4 +0,0 @@
|
||||
<template name="keycloakLoginButton">
|
||||
<hr/>
|
||||
<button class="form-control btn js-login-keycloak">Login with Keycloak</button>
|
||||
</template>
|
||||
@ -1,18 +0,0 @@
|
||||
import { Meteor } from 'meteor/meteor';
|
||||
import { Template } from 'meteor/templating';
|
||||
import { Router } from 'meteor/clinical:router';
|
||||
import { OHIF } from 'meteor/ohif:core';
|
||||
|
||||
import './keycloakLoginButton.html';
|
||||
|
||||
Template.keycloakLoginButton.events({
|
||||
'click .js-login-keycloak'() {
|
||||
Meteor.loginWithMeteorKeycloak({}, function(error) {
|
||||
if (error) {
|
||||
throw new Error(error);
|
||||
}
|
||||
|
||||
Router.go('/studylist');
|
||||
});
|
||||
}
|
||||
});
|
||||
@ -1,25 +0,0 @@
|
||||
import { Accounts } from 'meteor/accounts-base';
|
||||
import { Meteor } from "meteor/meteor";
|
||||
|
||||
OHIF.user.getAccessToken = () => {
|
||||
const user = Meteor.user();
|
||||
if (!user) {
|
||||
return;
|
||||
}
|
||||
|
||||
return user.services.keycloak.accessToken;
|
||||
};
|
||||
|
||||
Accounts.onLogin(() => {
|
||||
Meteor.subscribe('user.services.keycloak', () => {
|
||||
sessionStorage.token = OHIF.user.getAccessToken();
|
||||
});
|
||||
});
|
||||
|
||||
Accounts.onLogout(() => {
|
||||
const authServerUrl = Meteor.settings.public.custom.keycloak.authServerUrl;
|
||||
const realm = Meteor.settings.public.custom.keycloak.realmName;
|
||||
const redirectUri = Meteor.absoluteUrl('login');
|
||||
const logoutUrl = `${authServerUrl}/realms/${realm}/protocol/openid-connect/logout?redirect_uri=${redirectUri}`;
|
||||
window.location = logoutUrl;
|
||||
});
|
||||
@ -1,3 +0,0 @@
|
||||
import './handlers';
|
||||
import './setup.js';
|
||||
import './components/keycloakLoginButton.js';
|
||||
@ -1,30 +0,0 @@
|
||||
import { Meteor } from 'meteor/meteor';
|
||||
import { Router } from 'meteor/clinical:router';
|
||||
import { OHIF } from 'meteor/ohif:core';
|
||||
|
||||
Router.waitOn(function() {
|
||||
return [
|
||||
Meteor.subscribe('user.services.keycloak'),
|
||||
];
|
||||
}, { except: ['userLogin'] });
|
||||
|
||||
Router.onBeforeAction(function() {
|
||||
// Check if user is signed in
|
||||
if (!Meteor.userId() && !Meteor.loggingIn()) {
|
||||
this.redirect('userLogin');
|
||||
} else {
|
||||
this.next();
|
||||
}
|
||||
}, {
|
||||
except: ['userLogin', 'entrySignUp', 'forgotPassword', 'resetPassword']
|
||||
});
|
||||
|
||||
OHIF.user.additionalLoginButtons = OHIF.user.additionalLoginButtons || [];
|
||||
|
||||
OHIF.user.additionalLoginButtons.push({
|
||||
template: 'keycloakLoginButton'
|
||||
});
|
||||
|
||||
if (!Meteor.settings.public.userAuthenticationRoutesEnabled) {
|
||||
OHIF.log.error('Please set Meteor.settings.public.userAuthenticationRoutesEnabled=true');
|
||||
}
|
||||
@ -1,51 +0,0 @@
|
||||
import { Meteor } from 'meteor/meteor';
|
||||
import { ServiceConfiguration } from 'meteor/service-configuration';
|
||||
import { Accounts } from "meteor/accounts-base";
|
||||
|
||||
console.log('Keycloak settings were found! Enabling Keycloak integration.');
|
||||
|
||||
ServiceConfiguration.configurations.upsert(
|
||||
{ service: 'keycloak' },
|
||||
{
|
||||
$set: {
|
||||
"realm": Meteor.settings.public.custom.keycloak.realmName,
|
||||
"auth-server-url": Meteor.settings.public.custom.keycloak.authServerUrl,
|
||||
"auth_redirect_uri": Meteor.settings.keycloak.authRedirectUri,
|
||||
"ssl-required": Meteor.settings.keycloak.sslRequired,
|
||||
"resource": Meteor.settings.keycloak.clientId,
|
||||
"client_id": Meteor.settings.keycloak.clientId,
|
||||
"loginStyle": Meteor.settings.keycloak.loginStyle,
|
||||
"secret": Meteor.settings.keycloak.clientSecret,
|
||||
"realm-public-key": Meteor.settings.keycloak.realmPublicKey,
|
||||
"public-client": false,
|
||||
"use-resource-role-mappings": false,
|
||||
"bearer-only": false,
|
||||
}
|
||||
}
|
||||
);
|
||||
|
||||
Meteor.publish('user.services.keycloak', function() {
|
||||
const userId = this.userId;
|
||||
if (!userId) {
|
||||
return [];
|
||||
}
|
||||
|
||||
return Meteor.users.find(userId, {
|
||||
fields: {
|
||||
'services.keycloak': 1
|
||||
}
|
||||
});
|
||||
});
|
||||
|
||||
Accounts.onLogout(({ user }) => {
|
||||
if (!user) {
|
||||
return;
|
||||
}
|
||||
|
||||
// Erase any Keycloak token that exists
|
||||
Meteor.users.update(user._id, {
|
||||
$unset: {
|
||||
'services.keycloak': 1
|
||||
}
|
||||
});
|
||||
});
|
||||
@ -1,11 +0,0 @@
|
||||
import { Meteor } from 'meteor/meteor';
|
||||
|
||||
if (!Meteor.settings.public ||
|
||||
!Meteor.settings.public.custom ||
|
||||
!Meteor.settings.public.custom.keycloak ||
|
||||
!Meteor.settings.keycloak) {
|
||||
|
||||
console.log('To use the ohif-user-keycloak package, you must add relevant Keycloak settings to Meteor.settings.keycloak (server-side).');
|
||||
} else {
|
||||
require('../imports/server/setup.js')
|
||||
}
|
||||
@ -23,7 +23,6 @@ Package.onUse(function(api) {
|
||||
// Our custom packages
|
||||
api.use('ohif:design');
|
||||
api.use('ohif:core');
|
||||
api.use('ohif:user');
|
||||
api.use('ohif:study-list');
|
||||
|
||||
// Client imports
|
||||
|
||||
@ -41,4 +41,3 @@ Meteor.startup(function() {
|
||||
createDemoUser();
|
||||
|
||||
});
|
||||
|
||||
|
||||
1
Packages/ohif-user-meteor-accounts/client/main.js
Normal file
1
Packages/ohif-user-meteor-accounts/client/main.js
Normal file
@ -0,0 +1 @@
|
||||
require('../imports/client/index.js');
|
||||
@ -3,7 +3,7 @@ import { OHIF } from 'meteor/ohif:core';
|
||||
|
||||
// Throw error if there is no user logged in
|
||||
OHIF.user.validate = () => {
|
||||
if (!Meteor.userId()) {
|
||||
if (!OHIF.user.userLoggedIn()) {
|
||||
throw new Meteor.Error('not-authorized');
|
||||
}
|
||||
};
|
||||
@ -4,7 +4,7 @@ import { OHIF } from 'meteor/ohif:core';
|
||||
OHIF.user.getName = () => {
|
||||
const user = Meteor.user();
|
||||
if (!user) return '';
|
||||
const nameSplit = Meteor.user().profile.fullName.split(' ');
|
||||
const nameSplit = user.profile.fullName.split(' ');
|
||||
const lastName = nameSplit[nameSplit.length - 1];
|
||||
nameSplit[nameSplit.length - 1] = lastName.substr(0, 1) + '.';
|
||||
return nameSplit.join(' ');
|
||||
@ -0,0 +1,4 @@
|
||||
import { Meteor } from 'meteor/meteor';
|
||||
import { OHIF } from 'meteor/ohif:core';
|
||||
|
||||
OHIF.user.getUserId = () => Meteor.userId();
|
||||
@ -1,6 +1,10 @@
|
||||
import './data';
|
||||
import './getName';
|
||||
import './getUserId';
|
||||
import './getAccessToken';
|
||||
import './login';
|
||||
import './logout';
|
||||
import './schema';
|
||||
import './userLoggedIn';
|
||||
|
||||
import './userLogin'
|
||||
@ -1,3 +1,4 @@
|
||||
import { Meteor } from "meteor/meteor";
|
||||
import { Router } from 'meteor/clinical:router';
|
||||
|
||||
if (Meteor.settings.public.userAuthenticationRoutesEnabled === true) {
|
||||
@ -0,0 +1,4 @@
|
||||
import { Meteor } from 'meteor/meteor';
|
||||
import { OHIF } from 'meteor/ohif:core';
|
||||
|
||||
OHIF.user.userLoggedIn = () => !!Meteor.userId();
|
||||
@ -0,0 +1,3 @@
|
||||
import './userLogin.html';
|
||||
import './userLogin.js';
|
||||
import './userLogin.styl';
|
||||
@ -0,0 +1,3 @@
|
||||
import './mongo.js';
|
||||
import './user.js';
|
||||
import './wadoProxy.js';
|
||||
@ -0,0 +1,21 @@
|
||||
import { Meteor } from "meteor/meteor";
|
||||
import { Accounts } from "meteor/accounts-base";
|
||||
import { OHIF } from "meteor/ohif:core";
|
||||
|
||||
const doAuth = Meteor.users.find().count() ? true : false;
|
||||
|
||||
OHIF.user.authenticateUser = request => {
|
||||
// Only allow logged-in users to access this route
|
||||
const userId = request.headers['x-user-id'];
|
||||
const loginToken = request.headers['x-auth-token'];
|
||||
if (!userId || !loginToken) {
|
||||
return;
|
||||
}
|
||||
|
||||
const hashedToken = Accounts._hashLoginToken(loginToken);
|
||||
|
||||
return !!Meteor.users.findOne({
|
||||
_id: userId,
|
||||
'services.resume.loginTokens.hashedToken': hashedToken
|
||||
});
|
||||
};
|
||||
@ -1,26 +1,23 @@
|
||||
Package.describe({
|
||||
name: 'ohif:user-keycloak',
|
||||
summary: 'OHIF Integration with Keycloak for Identity and Access Management',
|
||||
name: 'ohif:user-meteor-accounts',
|
||||
summary: 'OHIF Integration with Meteor Accounts',
|
||||
version: '0.0.1'
|
||||
});
|
||||
|
||||
Package.onUse(function(api) {
|
||||
api.versionsFrom('1.6');
|
||||
|
||||
api.use('templating');
|
||||
api.use('ecmascript');
|
||||
api.use('service-configuration');
|
||||
|
||||
api.use('accounts-base');
|
||||
api.use('accounts-password');
|
||||
|
||||
// Our custom packages
|
||||
api.use('ohif:core');
|
||||
api.use('ohif:user');
|
||||
|
||||
api.use('mxab:keycloak-oauth@0.0.2');
|
||||
api.use('mxab:keycloak-loader@0.0.2');
|
||||
api.use('mxab:accounts-keycloak');
|
||||
|
||||
// Client imports
|
||||
api.mainModule('client/main.js', 'client');
|
||||
|
||||
// Server imports
|
||||
api.mainModule('server/main.js', 'server');
|
||||
});
|
||||
1
Packages/ohif-user-meteor-accounts/server/main.js
Normal file
1
Packages/ohif-user-meteor-accounts/server/main.js
Normal file
@ -0,0 +1 @@
|
||||
require('../imports/server/index.js');
|
||||
10
Packages/ohif-user-oidc/client/main.js
Normal file
10
Packages/ohif-user-oidc/client/main.js
Normal file
@ -0,0 +1,10 @@
|
||||
import { Meteor } from 'meteor/meteor';
|
||||
|
||||
if (!Meteor.settings.public ||
|
||||
!Meteor.settings.public.custom ||
|
||||
!Meteor.settings.public.custom.oidc) {
|
||||
|
||||
console.log('To use the ohif-user-oidc package, you must add relevant OpenID Connect settings to Meteor.settings.public.custom.oidc (client-side).');
|
||||
} else {
|
||||
require('../imports/client/index.js')
|
||||
}
|
||||
2
Packages/ohif-user-oidc/imports/client/index.js
Normal file
2
Packages/ohif-user-oidc/imports/client/index.js
Normal file
@ -0,0 +1,2 @@
|
||||
import './oidcUserManager.js';
|
||||
import './routes.js';
|
||||
78
Packages/ohif-user-oidc/imports/client/oidcUserManager.js
Normal file
78
Packages/ohif-user-oidc/imports/client/oidcUserManager.js
Normal file
@ -0,0 +1,78 @@
|
||||
import { Meteor } from "meteor/meteor";
|
||||
import { OHIF } from 'meteor/ohif:core';
|
||||
import Oidc from 'oidc-client';
|
||||
|
||||
Oidc.Log.logger = console;
|
||||
Oidc.Log.level = Oidc.Log.DEBUG;
|
||||
|
||||
const { oidc } = Meteor.settings.public.custom;
|
||||
|
||||
if (oidc.length > 1) {
|
||||
OHIF.log.warn("Only one OpenID Connect provider is currently supported. Using the first item in the Meteor.settings.public.custom.oidc array.")
|
||||
}
|
||||
|
||||
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');
|
||||
|
||||
|
||||
const settings = {
|
||||
authority: oidcClient.authServerUrl,
|
||||
client_id: oidcClient.clientId,
|
||||
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
|
||||
automaticSilentRenew: true,
|
||||
revokeAccessTokenOnSignout: true,
|
||||
};
|
||||
|
||||
const itemName = `oidc.user:${oidcClient.authServerUrl}:${oidcClient.clientId}`;
|
||||
|
||||
function getTokenFromStorage() {
|
||||
const userDataJSON = sessionStorage.getItem(itemName);
|
||||
const user = JSON.parse(userDataJSON);
|
||||
|
||||
if (!user) {
|
||||
return;
|
||||
}
|
||||
|
||||
return user.access_token;
|
||||
}
|
||||
|
||||
OHIF.user.getAccessToken = function oidcGetAccessToken() {
|
||||
if (!OHIF.user.userLoggedIn) {
|
||||
throw new Error('User is not logged in.');
|
||||
}
|
||||
|
||||
return getTokenFromStorage();
|
||||
};
|
||||
|
||||
OHIF.user.logout = function oidcLogout() {
|
||||
oidcUserManager.signoutRedirect();
|
||||
}
|
||||
|
||||
OHIF.user.userLoggedIn = () => !!getTokenFromStorage();
|
||||
|
||||
// See https://github.com/IdentityModel/oidc-client-js/wiki for more information
|
||||
const oidcUserManager = new Oidc.UserManager(settings);
|
||||
|
||||
const LOGIN_REQUIRED = 'login_required'
|
||||
|
||||
function handleSilentRenewError(error) {
|
||||
console.error(error);
|
||||
|
||||
if (error.error === LOGIN_REQUIRED) {
|
||||
OHIF.user.logout();
|
||||
}
|
||||
}
|
||||
|
||||
oidcUserManager.events.addSilentRenewError(handleSilentRenewError);
|
||||
|
||||
oidcUserManager.events.addAccessTokenExpired(function(){
|
||||
OHIF.user.logout();
|
||||
});
|
||||
|
||||
export default oidcUserManager;
|
||||
79
Packages/ohif-user-oidc/imports/client/routes.js
Normal file
79
Packages/ohif-user-oidc/imports/client/routes.js
Normal file
@ -0,0 +1,79 @@
|
||||
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 next = this.next;
|
||||
const redirect_uri = Meteor.absoluteUrl(this.request.url);
|
||||
|
||||
if (OHIF.user.userLoggedIn()) {
|
||||
next()
|
||||
} else if (urlHasSignInResponse() === true) {
|
||||
processSignInResponse().then(next);
|
||||
} else {
|
||||
signIn({ redirect_uri });
|
||||
}
|
||||
});
|
||||
25
Packages/ohif-user-oidc/package.js
Normal file
25
Packages/ohif-user-oidc/package.js
Normal file
@ -0,0 +1,25 @@
|
||||
Package.describe({
|
||||
name: 'ohif:user-oidc',
|
||||
summary: 'OHIF Integration with OpenID Connect',
|
||||
version: '0.0.1'
|
||||
});
|
||||
|
||||
Npm.depends({
|
||||
'oidc-client': '1.5.2'
|
||||
});
|
||||
|
||||
Package.onUse(function(api) {
|
||||
api.versionsFrom('1.6');
|
||||
|
||||
api.use('ecmascript', 'client');
|
||||
|
||||
// Our custom packages
|
||||
api.use('ohif:core', 'client');
|
||||
|
||||
// Client imports
|
||||
api.mainModule('client/main.js', 'client');
|
||||
|
||||
api.addAssets('public/js/oidc-client.min.js', 'client');
|
||||
api.addAssets('public/js/silentRefresh.js', 'client');
|
||||
api.addAssets('public/silent-refresh.html', 'client');
|
||||
});
|
||||
46
Packages/ohif-user-oidc/public/js/oidc-client.min.js
vendored
Normal file
46
Packages/ohif-user-oidc/public/js/oidc-client.min.js
vendored
Normal file
File diff suppressed because one or more lines are too long
1
Packages/ohif-user-oidc/public/js/silentRefresh.js
Normal file
1
Packages/ohif-user-oidc/public/js/silentRefresh.js
Normal file
@ -0,0 +1 @@
|
||||
new UserManager().signinSilentCallback().catch(console.error);
|
||||
11
Packages/ohif-user-oidc/public/silent-refresh.html
Normal file
11
Packages/ohif-user-oidc/public/silent-refresh.html
Normal file
@ -0,0 +1,11 @@
|
||||
<!DOCTYPE html>
|
||||
<html lang="en">
|
||||
<head>
|
||||
<meta charset="UTF-8">
|
||||
<title>Silent OpenID Connect Token Refresh Page</title>
|
||||
</head>
|
||||
<body>
|
||||
<script type="text/javascript" src="js/oidc-client.min.js"></script>
|
||||
<script type="text/javascript" src="js/silentRefresh.js"></script>
|
||||
</body>
|
||||
</html>
|
||||
@ -1,3 +0,0 @@
|
||||
import './login/userLogin.html';
|
||||
import './login/userLogin.js';
|
||||
import './login/userLogin.styl';
|
||||
@ -1,3 +0,0 @@
|
||||
import './components';
|
||||
import './lib';
|
||||
import './routes';
|
||||
@ -1,10 +0,0 @@
|
||||
import { OHIF } from 'meteor/ohif:core';
|
||||
|
||||
/*
|
||||
* Defines the base OHIF user object
|
||||
*/
|
||||
const user = {};
|
||||
|
||||
OHIF.user = user;
|
||||
|
||||
export { user };
|
||||
@ -1,36 +0,0 @@
|
||||
Package.describe({
|
||||
name: 'ohif:user',
|
||||
summary: 'OHIF User Authentication Handling',
|
||||
version: '0.0.1'
|
||||
});
|
||||
|
||||
Package.onUse(function(api) {
|
||||
api.versionsFrom('1.4');
|
||||
|
||||
// Meteor client and server packages
|
||||
api.use([
|
||||
'ecmascript',
|
||||
'accounts-base',
|
||||
'accounts-password'
|
||||
]);
|
||||
|
||||
// Meteor client-only packages
|
||||
api.use([
|
||||
'templating',
|
||||
'stylus',
|
||||
'clinical:router'
|
||||
], 'client');
|
||||
|
||||
// OHIF dependencies
|
||||
api.use('ohif:design');
|
||||
api.use('ohif:core');
|
||||
|
||||
// Main module
|
||||
api.mainModule('main.js', ['client', 'server']);
|
||||
|
||||
// Server imports
|
||||
api.addFiles('server/index.js', 'server');
|
||||
|
||||
// Client imports
|
||||
api.addFiles('client/index.js', 'client');
|
||||
});
|
||||
@ -1 +0,0 @@
|
||||
import './user.js';
|
||||
@ -140,7 +140,7 @@ class WindowLevelPresetsManager {
|
||||
return new Promise((resolve, reject) => {
|
||||
if (this.storeFunction) {
|
||||
this.storeFunction.call(this, WL_STORAGE_KEY, wlPresets).then(resolve).catch(reject);
|
||||
} else if (Meteor.userId()) {
|
||||
} else if (OHIF.user.userLoggedIn()) {
|
||||
OHIF.user.setData(WL_STORAGE_KEY, wlPresets).then(resolve).catch(reject);
|
||||
} else {
|
||||
Session.setPersistent(WL_STORAGE_KEY, wlPresets);
|
||||
|
||||
@ -1,6 +1,5 @@
|
||||
import { Meteor } from 'meteor/meteor';
|
||||
import { Router } from 'meteor/clinical:router';
|
||||
import { Accounts } from 'meteor/accounts-base';
|
||||
import { OHIF } from 'meteor/ohif:core';
|
||||
import { Servers } from 'meteor/ohif:servers/both/collections';
|
||||
|
||||
@ -9,23 +8,17 @@ const http = require('http');
|
||||
const https = require('https');
|
||||
const now = require('performance-now');
|
||||
|
||||
const doAuth = Meteor.users.find().count() ? true : false;
|
||||
// The WADO Proxy can perform user authentication if desired.
|
||||
// In order to use this, create a function to override
|
||||
// OHIF.user.authenticateUser(request), which returns a Boolean.
|
||||
let doAuth = false;
|
||||
let authenticateUser = null;
|
||||
|
||||
const authenticateUser = request => {
|
||||
// Only allow logged-in users to access this route
|
||||
const userId = request.headers['x-user-id'];
|
||||
const loginToken = request.headers['x-auth-token'];
|
||||
if (!userId || !loginToken) {
|
||||
return;
|
||||
}
|
||||
|
||||
const hashedToken = Accounts._hashLoginToken(loginToken);
|
||||
|
||||
return Meteor.users.findOne({
|
||||
_id: userId,
|
||||
'services.resume.loginTokens.hashedToken': hashedToken
|
||||
});
|
||||
};
|
||||
if (OHIF.user &&
|
||||
OHIF.user.authenticateUser) {
|
||||
doAuth = true;
|
||||
authenticateUser = OHIF.user.authenticateUser;
|
||||
}
|
||||
|
||||
const handleRequest = function() {
|
||||
const request = this.request;
|
||||
|
||||
Loading…
Reference in New Issue
Block a user