feat(keycloak) Optional Keycloak integration via OpenId Connect (OIDC) for Identity and Access Management (#227)

This commit is contained in:
Erik Ziegler authored and GitHub committed 2018-07-19 13:57:23 +02:00
1 parent 03d0798459
commit 33755f7b8b
25 files changed
+294 -11

No files matched your search

+5 -1
View File
@@ -25,7 +25,9 @@ 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
@@ -42,6 +44,8 @@ ohif:dicom-services
ohif:dicomweb-client
ohif:hanging-protocols
ohif:metadata
ohif:user
ohif:user-keycloak
fortawesome:fontawesome
momentjs:moment@2.15.1
+14
View File
@@ -1,4 +1,6 @@
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
@@ -38,6 +40,7 @@ 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
@@ -77,8 +80,15 @@ 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
@@ -98,6 +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-keycloak@0.0.1
ohif:viewerbase@0.0.1
ohif:wadoproxy@0.0.1
ordered-dict@1.1.0
@@ -113,11 +125,13 @@ 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
@@ -1,3 +1,4 @@
import { Meteor } from 'meteor/meteor';
import { Template } from 'meteor/templating';
import { Session } from 'meteor/session';
import { Router } from 'meteor/clinical:router';
@@ -8,7 +9,7 @@ Template.ohifViewer.onCreated(() => {
const instance = Template.instance();
instance.headerClasses = new ReactiveVar('');
OHIF.header.dropdown.setItems([{
const headerItems = [{
action: () => OHIF.ui.showDialog('serverInformationModal'),
text: 'Server Information',
icon: 'fa fa-server fa-lg',
@@ -28,7 +29,18 @@ Template.ohifViewer.onCreated(() => {
action: () => OHIF.ui.showDialog('aboutModal'),
text: 'About',
icon: 'fa fa-info'
}]);
}];
if (Meteor.user()) {
items.push({
action: OHIF.user.logout,
text: 'Logout',
iconClasses: 'logout',
iconSvgUse: 'packages/ohif_viewerbase/assets/user-menu-icons.svg#logout'
});
}
OHIF.header.dropdown.setItems(headerItems);
instance.autorun(() => {
const currentRoute = Router.current();
+18
View File
@@ -1,6 +1,7 @@
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);
@@ -19,4 +20,21 @@ Meteor.startup(function() {
};
cornerstoneWADOImageLoader.webWorkerManager.initialize(config);
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);
}
}
}
});
});