diff options
Diffstat (limited to 'so-cnf-adapter-application/src')
3 files changed, 26 insertions, 2 deletions
diff --git a/so-cnf-adapter-application/src/main/java/org/onap/so/adapters/cnf/BpmnInfraConfiguration.java b/so-cnf-adapter-application/src/main/java/org/onap/so/adapters/cnf/BpmnInfraConfiguration.java new file mode 100644 index 0000000..a06ad92 --- /dev/null +++ b/so-cnf-adapter-application/src/main/java/org/onap/so/adapters/cnf/BpmnInfraConfiguration.java @@ -0,0 +1,15 @@ +package org.onap.so.adapters.cnf; + +import org.springframework.beans.factory.annotation.Value; +import org.springframework.context.annotation.Configuration; + +@Configuration +public class BpmnInfraConfiguration { + + @Value("${mso.adapters.requestDb.auth}") + private String auth; + + public String getAuth() { + return auth; + } +} diff --git a/so-cnf-adapter-application/src/main/java/org/onap/so/adapters/cnf/client/SoCallbackClient.java b/so-cnf-adapter-application/src/main/java/org/onap/so/adapters/cnf/client/SoCallbackClient.java index f6e39e8..9372983 100644 --- a/so-cnf-adapter-application/src/main/java/org/onap/so/adapters/cnf/client/SoCallbackClient.java +++ b/so-cnf-adapter-application/src/main/java/org/onap/so/adapters/cnf/client/SoCallbackClient.java @@ -1,6 +1,7 @@ package org.onap.so.adapters.cnf.client; import com.google.gson.Gson; +import org.onap.so.adapters.cnf.BpmnInfraConfiguration; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.http.HttpEntity; import org.springframework.http.HttpHeaders; @@ -17,12 +18,15 @@ import static org.springframework.http.HttpMethod.POST; @Component public class SoCallbackClient { - private final RestTemplate restTemplate; private final static Gson gson = new Gson(); + private final RestTemplate restTemplate; + private final BpmnInfraConfiguration bpmnInfraConfiguration; + @Autowired - public SoCallbackClient(RestTemplate restTemplate) { + public SoCallbackClient(RestTemplate restTemplate, BpmnInfraConfiguration bpmnInfraConfiguration) { this.restTemplate = restTemplate; + this.bpmnInfraConfiguration = bpmnInfraConfiguration; } public ResponseEntity<String> sendPostCallback(String url, Object body) { @@ -35,6 +39,7 @@ public class SoCallbackClient { acceptableMediaTypes.add(MediaType.APPLICATION_JSON); headers.setAccept(acceptableMediaTypes); headers.setContentType(MediaType.APPLICATION_JSON); + headers.add(HttpHeaders.AUTHORIZATION, bpmnInfraConfiguration.getAuth()); return new HttpEntity<>(gson.toJson(body), headers); } diff --git a/so-cnf-adapter-application/src/main/resources/application.yaml b/so-cnf-adapter-application/src/main/resources/application.yaml index c9b786d..dc277e5 100644 --- a/so-cnf-adapter-application/src/main/resources/application.yaml +++ b/so-cnf-adapter-application/src/main/resources/application.yaml @@ -61,4 +61,8 @@ multicloud: # security: # enabled: false # basic: +mso: + adapters: + requestDb: + auth: # enabled: false
\ No newline at end of file |