feat(openid-connect): Switch to generic OIDC Client library instead of using Keycloak.js (#273)
This commit is contained in:
1 parent
2f05ed5961
commit
18bcf83805
70 files changed
+572
-655
No files matched your search
@@ -4,3 +4,4 @@ import './string.js';
|
||||
import './ui.js';
|
||||
import './utils.js';
|
||||
import './viewer.js';
|
||||
import './user.js';
|
||||
@@ -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,26 +0,0 @@
|
||||
import { OHIF } from 'meteor/ohif:core';
|
||||
import { Meteor } from 'meteor/meteor';
|
||||
|
||||
// Mongo data manipulation utilities
|
||||
class MongoUtils {
|
||||
|
||||
// Check if there is an user logged in
|
||||
static validateUser() {
|
||||
// Throw error if there is no user logged in
|
||||
if (!Meteor.userId()) {
|
||||
throw new Meteor.Error('not-authorized');
|
||||
}
|
||||
}
|
||||
|
||||
// Generic callback to MongoDB write operations
|
||||
static writeCallback(error, affected) {
|
||||
// Throw error if it was not possible to complete the write operation
|
||||
if (error) {
|
||||
throw new Meteor.Error('data-write', error);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
// Expose the class in the OHIF object
|
||||
OHIF.MongoUtils = MongoUtils;
|
||||
Reference in new issue
Block a user