fix: remove requestOptions when key is not needed

This commit is contained in:
dannyrb 2019-09-09 15:49:12 -04:00
parent bad987a06b
commit 32bc47d315
12 changed files with 21 additions and 48 deletions

View File

@ -53,9 +53,6 @@ window.config = {
qidoSupportsIncludeField: true, qidoSupportsIncludeField: true,
imageRendering: 'wadors', imageRendering: 'wadors',
thumbnailRendering: 'wadors', thumbnailRendering: 'wadors',
requestOptions: {
requestFromBrowser: true,
},
}, },
], ],
}, },

View File

@ -59,9 +59,6 @@ window.config = {
qidoSupportsIncludeField: true, qidoSupportsIncludeField: true,
imageRendering: 'wadors', imageRendering: 'wadors',
thumbnailRendering: 'wadors', thumbnailRendering: 'wadors',
requestOptions: {
requestFromBrowser: true,
},
}, },
], ],
}, },

View File

@ -6,17 +6,21 @@ import user from '../user';
/** /**
* Returns the Authorization header as part of an Object. * Returns the Authorization header as part of an Object.
* *
* @returns {Object} * @export
* @param {Object} [server={}]
* @param {Object} [server.requestOptions]
* @param {string} [server.requestOptions.auth]
* @returns {Object} { Authorization }
*/ */
export default function getAuthorizationHeader(server) { export default function getAuthorizationHeader({ requestOptions } = {}) {
const headers = {}; const headers = {};
// Check for OHIF.user since this can also be run on the server // Check for OHIF.user since this can also be run on the server
const accessToken = user && user.getAccessToken && user.getAccessToken(); const accessToken = user && user.getAccessToken && user.getAccessToken();
if (server && server.requestOptions && server.requestOptions.auth) { if (requestOptions && requestOptions.auth) {
// HTTP Basic Auth (user:password) // HTTP Basic Auth (user:password)
headers.Authorization = `Basic ${btoa(server.requestOptions.auth)}`; headers.Authorization = `Basic ${btoa(requestOptions.auth)}`;
} else if (accessToken) { } else if (accessToken) {
headers.Authorization = `Bearer ${accessToken}`; headers.Authorization = `Bearer ${accessToken}`;
} }

View File

@ -11,9 +11,6 @@ describe('addServers', () => {
qidoSupportsIncludeField: true, qidoSupportsIncludeField: true,
imageRendering: 'wadors', imageRendering: 'wadors',
thumbnailRendering: 'wadors', thumbnailRendering: 'wadors',
requestOptions: {
requestFromBrowser: true,
},
}, },
], ],
oidc: [ oidc: [
@ -52,7 +49,6 @@ describe('addServers', () => {
name: 'DCM4CHEE', name: 'DCM4CHEE',
qidoRoot: 'https://server.dcmjs.org/dcm4chee-arc/aets/DCM4CHEE/rs', qidoRoot: 'https://server.dcmjs.org/dcm4chee-arc/aets/DCM4CHEE/rs',
qidoSupportsIncludeField: true, qidoSupportsIncludeField: true,
requestOptions: { requestFromBrowser: true },
thumbnailRendering: 'wadors', thumbnailRendering: 'wadors',
type: 'dicomWeb', type: 'dicomWeb',
wadoRoot: 'https://server.dcmjs.org/dcm4chee-arc/aets/DCM4CHEE/rs', wadoRoot: 'https://server.dcmjs.org/dcm4chee-arc/aets/DCM4CHEE/rs',

View File

@ -13,9 +13,6 @@ window.config = {
qidoSupportsIncludeField: true, qidoSupportsIncludeField: true,
imageRendering: 'wadors', imageRendering: 'wadors',
thumbnailRendering: 'wadors', thumbnailRendering: 'wadors',
requestOptions: {
requestFromBrowser: true,
},
}, },
], ],
}, },

View File

@ -12,9 +12,6 @@ window.config = {
qidoSupportsIncludeField: true, qidoSupportsIncludeField: true,
imageRendering: 'wadors', imageRendering: 'wadors',
thumbnailRendering: 'wadors', thumbnailRendering: 'wadors',
requestOptions: {
requestFromBrowser: true,
},
}, },
], ],
}, },

View File

@ -11,9 +11,6 @@ window.config = {
qidoSupportsIncludeField: false, qidoSupportsIncludeField: false,
imageRendering: 'wadors', imageRendering: 'wadors',
thumbnailRendering: 'wadors', thumbnailRendering: 'wadors',
requestOptions: {
requestFromBrowser: true,
},
}, },
], ],
}, },

View File

@ -14,11 +14,10 @@ window.config = {
thumbnailRendering: 'wadors', thumbnailRendering: 'wadors',
// REQUIRED TAG: // REQUIRED TAG:
// TODO: Remove tag after https://github.com/OHIF/ohif-core/pull/19 is merged and we bump version // TODO: Remove tag after https://github.com/OHIF/ohif-core/pull/19 is merged and we bump version
requestOptions: { // requestOptions: {
// undefined to use JWT + Bearer auth // undefined to use JWT + Bearer auth
// auth: 'orthanc:orthanc', // auth: 'orthanc:orthanc',
requestFromBrowser: true, // },
},
}, },
], ],
}, },

View File

@ -12,15 +12,11 @@ window.config = {
qidoSupportsIncludeField: false, qidoSupportsIncludeField: false,
imageRendering: 'wadors', imageRendering: 'wadors',
thumbnailRendering: 'wadors', thumbnailRendering: 'wadors',
// REQUIRED TAG: // requestOptions: {
// https://github.com/OHIF/ohif-core/blob/59e1e04b92be24aee5d4402445cb3dcedb746995/src/studies/retrieveStudyMetadata.js#L54
// TODO: Remove tag after https://github.com/OHIF/ohif-core/pull/19 is merged and we bump version
requestOptions: {
// undefined to use JWT + Bearer auth // undefined to use JWT + Bearer auth
// auth: 'orthanc:orthanc', // auth: 'orthanc:orthanc',
requestFromBrowser: true, // },
},
}, },
], ],
}, },
} };

View File

@ -14,11 +14,10 @@ window.config = {
imageRendering: 'wadors', imageRendering: 'wadors',
thumbnailRendering: 'wadors', thumbnailRendering: 'wadors',
requestOptions: { requestOptions: {
requestFromBrowser: true,
auth: 'admin:admin', auth: 'admin:admin',
}, },
}, },
], ],
}, },
studyListFunctionsEnabled: true, studyListFunctionsEnabled: true,
} };

View File

@ -11,9 +11,6 @@ window.config = {
qidoSupportsIncludeField: true, qidoSupportsIncludeField: true,
imageRendering: 'wadors', imageRendering: 'wadors',
thumbnailRendering: 'wadors', thumbnailRendering: 'wadors',
requestOptions: {
requestFromBrowser: true,
},
}, },
], ],
}, },

View File

@ -11,15 +11,12 @@ window.config = {
qidoSupportsIncludeField: true, qidoSupportsIncludeField: true,
imageRendering: 'wadors', imageRendering: 'wadors',
thumbnailRendering: 'wadors', thumbnailRendering: 'wadors',
requestOptions: {
requestFromBrowser: true,
},
}, },
], ],
}, },
i18n: { i18n: {
LOCIZE_PROJECTID: 'a8da3f9a-e467-4dd6-af33-474d582a0294', LOCIZE_PROJECTID: 'a8da3f9a-e467-4dd6-af33-474d582a0294',
LOCIZE_API_KEY: null, // Developers can use this to do in-context editing. DO NOT COMMIT THIS KEY! LOCIZE_API_KEY: null, // Developers can use this to do in-context editing. DO NOT COMMIT THIS KEY!
USE_LOCIZE: false USE_LOCIZE: false,
} },
} };