Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Feature Request] OHIF connect Google Cloud Healthcare using API keys OR Service Account rather than OAuth #4091

Open
bhaumikprmindbowser opened this issue May 7, 2024 · 3 comments

Comments

@bhaumikprmindbowser
Copy link

bhaumikprmindbowser commented May 7, 2024

What feature or change would you like to see made?

I am using 3.8.0-beta.94(Latest) version. By following this Google Cloud Healthcare | OHIF I have managed to connect OHIF viewer to my Dataset and dicomStores on Google Cloud Healthcare using OAuth2.0.
When I run the application it redirects to the Google authentication page for authentication.
I don’t want that I want to application to be authenticated using API keys or the Service directory method, the user is not required to go Google login page my React app has a login page, and the user is already authenticated.

Options

I don’t want to user to log in, I already have a react site login so the user is already authenticated.
I have created a point where I generated json token using node js Authenticate to the Cloud Healthcare API | Google Cloud
but how to call and where to pass it so it directly authenticate user, user don’t get redirect to google login page.

Why should we prioritize this feature?

Connect Google Cloud Health Care with other option that It allow integration when webapp already have authenticated user

@sedghi
Copy link
Member

sedghi commented May 7, 2024

I think you need to have a server that you proxy the requests. The GCH will be a service account registered inside your server (simple express) so that you don't need to authenticate everytime

@bhaumikprmindbowser
Copy link
Author

bhaumikprmindbowser commented May 7, 2024

I have a Node App, which return a token using Service Account Json
I used token in GoogleCloudDataSourceConfigurationAPI file and replace this._fetchOptions and I got successfully connected to DataStore
I mean when it call https://cloudresourcemanager.googleapis.com/v1/projects/ it success but
while calling below api it shows me 401 , as it missing Authorization token
https://healthcare.googleapis.com/v1/projects

Where should I set that access token so it can be available everywhere

app-config.js

window.config = {
  routerBasename: '/',
  extensions: [],
  modes: [],
  customizationService: {},
  showStudyList: true,
  // some windows systems have issues with more than 3 web workers
  maxNumberOfWebWorkers: 3,
  // below flag is for performance reasons, but it might not work for all servers
  showWarningMessageForCrossOrigin: true,
  showCPUFallbackMessage: true,
  showLoadingIndicator: true,
  strictZSpacingForVolumeViewport: true,
  groupEnabledModesFirst: true,
  maxNumRequests: {
    interaction: 100,
    thumbnail: 75,
    // Prefetch number is dependent on the http protocol. For http 2 or
    // above, the number of requests can be go a lot higher.
    prefetch: 25,
  },
  // filterQueryParam: false,
  defaultDataSourceName: 'dicomweb',
  dataSources: [
    {
      namespace: '@ohif/extension-default.dataSourcesModule.dicomweb',
      sourceName: 'dicomweb',
      configuration: {
        friendlyName: 'dcmjs DICOMWeb Server',
        name: 'GCP',
        wadoUriRoot:
          'https://healthcare.googleapis.com/v1/projects/ProjextXXX/locations/us-central1/datasets/datasetsXXX/dicomStores/dicomStoresXXX',
        qidoRoot:
          'https://healthcare.googleapis.com/v1/projects/ProjextXXX/locations/us-central1/datasets/datasetsXXX/dicomStores/dicomStoresXXX',
        wadoRoot:
          'https://healthcare.googleapis.com/v1/projects/ProjextXXX/locations/us-central1/datasets/datasetsXXX/dicomStores/dicomStoresXXX',
        qidoSupportsIncludeField: true,
        imageRendering: 'wadors',
        thumbnailRendering: 'wadors',
        enableStudyLazyLoad: true,
        supportsFuzzyMatching: true,
        supportsWildcard: false,
        dicomUploadEnabled: true,
        omitQuotationForMultipartRequest: true,
        configurationAPI: 'ohif.dataSourceConfigurationAPI.google',
      },
    },
    {
      namespace: '@ohif/extension-default.dataSourcesModule.dicomjson',
      sourceName: 'dicomjson',
      configuration: {
        friendlyName: 'dicom json',
        name: 'json',
      },
    },
    {
      namespace: '@ohif/extension-default.dataSourcesModule.dicomlocal',
      sourceName: 'dicomlocal',
      configuration: {
        friendlyName: 'dicom local',
      },
    },
  ],
  httpErrorHandler: error => {
    // This is 429 when rejected from the public idc sandbox too often.
    console.warn(error.status);
    console.warn('test, navigate to https://ohif.org/');
  },
  hotkeys: [
    {
      commandName: 'incrementActiveViewport',
      label: 'Next Viewport',
      keys: ['right'],
    },
    {
      commandName: 'decrementActiveViewport',
      label: 'Previous Viewport',
      keys: ['left'],
    },
    { commandName: 'rotateViewportCW', label: 'Rotate Right', keys: ['r'] },
    { commandName: 'rotateViewportCCW', label: 'Rotate Left', keys: ['l'] },
    { commandName: 'invertViewport', label: 'Invert', keys: ['i'] },
    {
      commandName: 'flipViewportHorizontal',
      label: 'Flip Horizontally',
      keys: ['h'],
    },
    {
      commandName: 'flipViewportVertical',
      label: 'Flip Vertically',
      keys: ['v'],
    },
    { commandName: 'scaleUpViewport', label: 'Zoom In', keys: ['+'] },
    { commandName: 'scaleDownViewport', label: 'Zoom Out', keys: ['-'] },
    { commandName: 'fitViewportToWindow', label: 'Zoom to Fit', keys: ['='] },
    { commandName: 'resetViewport', label: 'Reset', keys: ['space'] },
    { commandName: 'nextImage', label: 'Next Image', keys: ['down'] },
    { commandName: 'previousImage', label: 'Previous Image', keys: ['up'] },
    {
      commandName: 'setToolActive',
      commandOptions: { toolName: 'Zoom' },
      label: 'Zoom',
      keys: ['z'],
    },
    // ~ Window level presets
    {
      commandName: 'windowLevelPreset1',
      label: 'W/L Preset 1',
      keys: ['1'],
    },
    {
      commandName: 'windowLevelPreset2',
      label: 'W/L Preset 2',
      keys: ['2'],
    },
    {
      commandName: 'windowLevelPreset3',
      label: 'W/L Preset 3',
      keys: ['3'],
    },
    {
      commandName: 'windowLevelPreset4',
      label: 'W/L Preset 4',
      keys: ['4'],
    },
    {
      commandName: 'windowLevelPreset5',
      label: 'W/L Preset 5',
      keys: ['5'],
    },
    {
      commandName: 'windowLevelPreset6',
      label: 'W/L Preset 6',
      keys: ['6'],
    },
    {
      commandName: 'windowLevelPreset7',
      label: 'W/L Preset 7',
      keys: ['7'],
    },
    {
      commandName: 'windowLevelPreset8',
      label: 'W/L Preset 8',
      keys: ['8'],
    },
    {
      commandName: 'windowLevelPreset9',
      label: 'W/L Preset 9',
      keys: ['9'],
    },
  ],
};

@sedghi
Copy link
Member

sedghi commented May 7, 2024

You should set it in userAuthenticationService, see here for an example platform/app/src/routes/Mode/updateAuthServiceAndCleanUrl.ts

  // if a token is passed in, set the userAuthenticationService to use it
  // for the Authorization header for all requests
  userAuthenticationService.setServiceImplementation({
    getAuthorizationHeader: () => ({
      Authorization: 'Bearer ' + token,
    }),
  });

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants