openBackhaul / MicroWaveDeviceGatekeeper

Gateway for PUTting to the devices
Apache License 2.0
1 stars 1 forks source link

To authenticate the individual services with path parameters #28

Closed PrathibaJee closed 9 months ago

PrathibaJee commented 10 months ago

Currently the apiKeyAuth handler in the validateSecurity openApiValidatorOptions in the onf-core-model-ap/applicationPattern/commons/AppCommons matches the incoming url with one of the operation-server’s operation-name. Further the operation-key in the incoming request will be validated against the operation-key in the matched operation-server to authenticate the request. This logic will work fine for the incoming request without any path parameters , where we can exactly match the incoming url with the operation-server.

Since in the MWDG application , we have individual services with path parameters , the existing logic to validate the operation-key will not work. This shall be handled in the application pattern issue https://github.com/openBackhaul/ApplicationPattern/issues/924

But until then , in the MWDG application we shall include the following logic to validate the operation key.

  1. In the server/utils folder create a file apiKeyAuth.js
  2. Include the following functionality ,
    
    // @ts-check
    'use strict';

const operationServerInterface = require('onf-core-model-ap/applicationPattern/onfModel/models/layerProtocols/OperationServerInterface');

/**