OHIF / Viewers

OHIF zero-footprint DICOM viewer and oncology specific Lesion Tracker, plus shared extension packages
https://docs.ohif.org/
MIT License
3.22k stars 3.32k forks source link

Connecting OHIF to dcm4chee-arc secure #2779

Closed m4mehdi closed 1 year ago

m4mehdi commented 2 years ago

What is the setting for connecting to DCM4CHEE arc secure version? I have installed the secure version DCM4CHEE-arch 5.26 and I wanna connect to PACS archive from OHIF. I don't know how to configure default.js? Where should we put the token which has delivered from dcm4chee keycloak? I've created a client for this issue in keycloak. I wanna know what is the configuration for getting token in default.js with client_id and client_credential to automatically token be added to WADO and API?

elamathis18 commented 2 years ago

hi @m4mehdi , were you able to find any workaround for this? I'm facing a similar problem for the use case.

orlando-cloudx commented 2 years ago

You can try something like this...

    window.config = {
    ...
    servers: {
        dicomWeb: [
        {
           ...
            requestOptions: {
              auth: options => {
                const token = 'HERE GOES THE TOKEN';
                return 'Bearer ' + token;
              },
            }
        },
        ],
    },
    window.config = {
    ...
    servers: {
        dicomWeb: [
        {
           ...
            requestOptions: {
              auth: options => {
                // use this if you want to pass the token in the URL like ?token=<TOKEN>
                const url = new URLSearchParams(window.location.search);
                const token = url.get('token');
                return 'Bearer ' + token;
              },
            }
        },
        ],
    },
elamathis18 commented 2 years ago

hi @orlando-cloudx, thank you for the input. I have added the token as you mentioned but I am still getting 401 when trying to add the same.

Below is my default.js

servers: {
    dicomWeb: [
      {
        name: 'DCM4CHEE',
        wadoUriRoot: 'https://test-ng:8443/dcm4chee-arc/aets/DCM4CHEE/wado',
        qidoRoot: 'https://test-ng:8443/dcm4chee-arc/aets/DCM4CHEE/rs',
        wadoRoot: 'https://test-ng:8443/dcm4chee-arc/aets/DCM4CHEE/rs',
        qidoSupportsIncludeField: true,
        imageRendering: 'wadors',
        thumbnailRendering: 'wadors',
        enableStudyLazyLoad: true,
        supportsFuzzyMatching: true,
        requestOptions: {
          auth: options => {
            const token = 'TOKEN';
            return 'Bearer ' + token;
          },
        }
      },
    ]
  }

I also found from another post where we add the platform/viewer/src/config.js Instead of this in line 47, const headers = OHIF.DICOMWeb.getAuthorizationHeader();

I changed to it, const headers = OHIF.DICOMWeb.getAuthorizationHeader(appConfig.servers.dicomWeb[0]);

But even then, there are no authentication in the headers.

scope-antofa commented 2 years ago

hi @elamathis18 you resolve this? I am having the same issue CORS with dcm4chee-arc-light- 5.28.0 secure and ohif 4.12

My ohif-config.js:

window.config = { // default: '/' routerBasename: '/', //MODIFCA LINK extensions: [], showStudyList: true, filterQueryParam: true, servers: { dicomWeb: [ { name: 'DCM4CHEE', wadoUriRoot: 'https://10.10.10.57:8443/dcm4chee-arc/aets/DCM4CHEE/wado', qidoRoot: 'https://10.10.10.57:8443/dcm4chee-arc/aets/DCM4CHEE/rs', wadoRoot: 'https://10.10.10.57:8443/dcm4chee-arc/aets/DCM4CHEE/rs', qidoSupportsIncludeField: false, //qidoSupportsIncludeField: true, imageRendering: 'wadors', thumbnailRendering: 'wadors', enableStudyLazyLoad: true, supportsFuzzyMatching: true, //auth for keycloak requestOptions: { auth: options => { // use this if you want to pass the token in the URL like ?token= const url = new URLSearchParams(window.location.search); const token = url.get('token'); return 'Bearer ' + token; },

    },
  },
],

}, ........

And my new Client on Keycloack:

image

image

No work :-(

image

Am I missing something? . Thanks for you help

sedghi commented 1 year ago

we have a orthanc and keycloak recipe that I know it works perfectly fine, so you can look there I assume https://docs.ohif.org/deployment/user-account-control

sedghi commented 3 months ago

We recently added several recipes for implementing authentication with Keycloak in OHIF. You can find them here:

https://docs.ohif.org/deployment/user-account-control