Files
ohif-viewer/platform/viewer/src/utils/getUserManagerForOpenIdConnectClient.js
T
DanielandDaniel Schiffl 04ca32a93e chore: OpenID Connect: Remove hard-coded loadUserInfo to make it configurable (#2167)
* removed hard-coded loadUserInfo

* undo styling

Co-authored-by: Daniel Schiffl <daniel.schiffl@stryker.com>
2020-11-13 15:55:43 +01:00

36 lines
1001 B
JavaScript

// https://github.com/maxmantz/redux-oidc/blob/master/docs/API.md
import { loadUser, createUserManager } from 'redux-oidc';
/**
* Creates a userManager from oidcSettings;
* loads the user into the provided redux store
* LINK: https://github.com/IdentityModel/oidc-client-js/wiki#configuration
*
* @param {*} store
* @param {Object} oidcSettings
* @param {string} oidcSettings.authServerUrl,
* @param {string} oidcSettings.clientId,
* @param {string} oidcSettings.authRedirectUri,
* @param {string} oidcSettings.postLogoutRedirectUri,
* @param {string} oidcSettings.responseType,
* @param {string} oidcSettings.extraQueryParams,
*/
export default function(store, oidcSettings) {
if (!store || !oidcSettings) {
return;
}
const settings = {
...oidcSettings,
automaticSilentRenew: true,
revokeAccessTokenOnSignout: true,
filterProtocolClaims: true,
};
const userManager = createUserManager(settings);
loadUser(store, userManager);
return userManager;
}