--- /dev/null
+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;
+ }
+}
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;
@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) {
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);
}