Update DeleteSliceService auth 64/108164/1
authorzm330 <zhangminyj@chinamobile.com>
Sat, 23 May 2020 04:01:07 +0000 (12:01 +0800)
committerzm330 <zhangminyj@chinamobile.com>
Sat, 23 May 2020 04:01:28 +0000 (12:01 +0800)
Issue-ID: SO-2942

Signed-off-by: zm330 <zhangminyj@chinamobile.com>
Change-Id: Ie177b4b29805e1625f96dfae576fd8ab2786c5fc

bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DeleteCommunicationService.groovy

index b121083..df034e6 100644 (file)
@@ -199,7 +199,7 @@ class DeleteCommunicationService extends AbstractServiceTaskProcessor {
      * 再次调用deleteE2EServiceInstance接口,然后获取到operationid,
      */
     void sendRequest2NSMFWF(DelegateExecution execution) {
-        LOGGER.trace("begin preRequestSend2NSMF")
+        LOGGER.debug("begin preRequestSend2NSMF")
         try {
             //url:/onap/so/infra/e2eServiceInstances/v3/{serviceInstanceId}"
             def NSMF_endpoint = UrnPropertiesReader.getVariable("mso.infra.endpoint.url", execution)
@@ -213,9 +213,13 @@ class DeleteCommunicationService extends AbstractServiceTaskProcessor {
             """
             requestBody.replaceAll("\\s+", "")
 
-            String basicAuthValue =  UrnPropertiesReader.getVariable("mso.infra.endpoint.auth", execution)
+            String msoKey = UrnPropertiesReader.getVariable("mso.msoKey", execution)
+            String basicAuth =  UrnPropertiesReader.getVariable("mso.infra.endpoint.auth", execution)
+            String basicAuthValue = utils.encrypt(basicAuth, msoKey)
+            String encodeString = utils.getBasicAuth(basicAuthValue, msoKey)
+
             HttpClient httpClient = getHttpClientFactory().newJsonClient(new URL(url), ONAPComponents.SO)
-            httpClient.addAdditionalHeader("Authorization", basicAuthValue)
+            httpClient.addAdditionalHeader("Authorization", encodeString)
             httpClient.addAdditionalHeader("Accept", "application/json")
             Response httpResponse = httpClient.delete(requestBody)
             handleNSSMFWFResponse(httpResponse, execution)
@@ -228,7 +232,7 @@ class DeleteCommunicationService extends AbstractServiceTaskProcessor {
             exceptionUtil.buildAndThrowWorkflowException(execution, 7000, msg)
         }
 
-        LOGGER.trace("exit preRequestSend2NSMF")
+        LOGGER.debug("exit preRequestSend2NSMF")
     }
 
     /**