summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--adapters/mso-sdnc-adapter/src/main/java/org/onap/so/adapters/sdnc/impl/Constants.java1
-rw-r--r--adapters/mso-sdnc-adapter/src/main/java/org/onap/so/adapters/sdnc/tasks/SDNCService.java136
-rw-r--r--adapters/mso-sdnc-adapter/src/main/java/org/onap/so/adapters/sdnc/tasks/TaskServices.java57
-rw-r--r--adapters/mso-sdnc-adapter/src/test/java/org/onap/so/adapters/sdnc/tasks/SDNCServiceTest.java72
-rw-r--r--adapters/mso-sdnc-adapter/src/test/resources/sdncRequest.json12
-rw-r--r--bpmn/MSOCommonBPMN/src/main/java/org/onap/so/client/exception/ExceptionBuilder.java15
-rw-r--r--common/src/main/java/org/onap/so/constants/Status.java1
-rw-r--r--common/src/main/java/org/onap/so/security/BaseWebSecurityConfigurerAdapter.java44
-rw-r--r--common/src/main/java/org/onap/so/security/CorsBasicHttpSecurityConfigurer.java33
-rw-r--r--common/src/main/java/org/onap/so/security/CorsWebSecurityConfigurerAdapter.java24
-rw-r--r--common/src/main/java/org/onap/so/security/SoBasicHttpSecurityConfigurer.java2
-rw-r--r--common/src/main/java/org/onap/so/security/SoWebSecurityConfigurerAdapter.java41
-rw-r--r--mso-api-handlers/mso-api-handler-common/src/main/java/org/onap/so/apihandler/common/RequestClientParameter.java32
13 files changed, 432 insertions, 38 deletions
diff --git a/adapters/mso-sdnc-adapter/src/main/java/org/onap/so/adapters/sdnc/impl/Constants.java b/adapters/mso-sdnc-adapter/src/main/java/org/onap/so/adapters/sdnc/impl/Constants.java
index da0fcd3d04..047686ccc3 100644
--- a/adapters/mso-sdnc-adapter/src/main/java/org/onap/so/adapters/sdnc/impl/Constants.java
+++ b/adapters/mso-sdnc-adapter/src/main/java/org/onap/so/adapters/sdnc/impl/Constants.java
@@ -31,6 +31,7 @@ public interface Constants {
public static final String SDNC_AUTH_PROP = "org.onap.so.adapters.sdnc.sdncauth";
public static final String BPEL_AUTH_PROP = "org.onap.so.adapters.sdnc.bpelauth";
+ public static final String SDNC_HOST = "org.onap.so.adapters.sdnc.sdncHost";
public static final String SDNC_SVCCFGRESP_ROOT = "input";
public static final String SDNC_REQ_ID = "/svc-request-id";
diff --git a/adapters/mso-sdnc-adapter/src/main/java/org/onap/so/adapters/sdnc/tasks/SDNCService.java b/adapters/mso-sdnc-adapter/src/main/java/org/onap/so/adapters/sdnc/tasks/SDNCService.java
new file mode 100644
index 0000000000..e5b7049934
--- /dev/null
+++ b/adapters/mso-sdnc-adapter/src/main/java/org/onap/so/adapters/sdnc/tasks/SDNCService.java
@@ -0,0 +1,136 @@
+package org.onap.so.adapters.sdnc.tasks;
+
+import java.security.GeneralSecurityException;
+import java.util.ArrayList;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+import javax.ws.rs.core.UriBuilder;
+import javax.xml.bind.DatatypeConverter;
+import org.camunda.bpm.client.task.ExternalTask;
+import org.camunda.bpm.client.task.ExternalTaskService;
+import org.onap.logging.filter.spring.SpringClientPayloadFilter;
+import org.onap.so.adapters.sdnc.impl.Constants;
+import org.onap.so.logging.jaxrs.filter.SOSpringClientFilter;
+import org.onap.so.logging.tasks.AuditMDCSetup;
+import org.onap.so.utils.CryptoUtils;
+import org.onap.so.utils.ExternalTaskUtils;
+import org.onap.so.utils.RetrySequenceLevel;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.core.env.Environment;
+import org.springframework.http.HttpEntity;
+import org.springframework.http.HttpHeaders;
+import org.springframework.http.HttpMethod;
+import org.springframework.http.HttpStatus;
+import org.springframework.http.MediaType;
+import org.springframework.http.ResponseEntity;
+import org.springframework.http.client.BufferingClientHttpRequestFactory;
+import org.springframework.http.client.HttpComponentsClientHttpRequestFactory;
+import org.springframework.stereotype.Component;
+import org.springframework.web.client.RestTemplate;
+import com.fasterxml.jackson.annotation.JsonInclude;
+import com.fasterxml.jackson.core.JsonProcessingException;
+import com.fasterxml.jackson.databind.ObjectMapper;
+
+@Component
+public class SDNCService extends ExternalTaskUtils {
+
+ private static final Logger logger = LoggerFactory.getLogger(SDNCService.class);
+
+ @Autowired
+ private AuditMDCSetup mdcSetup;
+
+ @Autowired
+ private RestTemplate restTemplate;
+
+ @Autowired
+ private Environment env;
+
+ private ObjectMapper objMapper = new ObjectMapper();
+
+ public SDNCService() {
+ super(RetrySequenceLevel.SHORT);
+ objMapper.setSerializationInclusion(JsonInclude.Include.NON_NULL);
+ }
+
+ // TODO maybe make a new sdnc client
+ public void executePostTask(ExternalTask externalTask, ExternalTaskService externalTaskService) {
+ mdcSetup.setupMDC(externalTask);
+ logger.debug("Executing External Task SDNC Post Service");
+ Map<String, Object> variables = new HashMap<>();
+ boolean success = false;
+ String errorMessage = "";
+ try {
+ Object request = externalTask.getVariable("sdncRequest");
+ String jsonRequest = buildJsonRequest(request);
+
+ UriBuilder url = UriBuilder.fromUri(env.getProperty(Constants.SDNC_HOST));
+ url.path((String) externalTask.getVariable("sdncUri"));
+
+ HttpEntity<String> requestEntity = new HttpEntity<String>(jsonRequest, getHttpHeader());
+ ResponseEntity<Object> responseEntity =
+ restTemplate.exchange(url.build(), HttpMethod.POST, requestEntity, Object.class);
+
+ if (responseEntity.getStatusCode().equals(HttpStatus.ACCEPTED)) {
+ success = true;
+ } else {
+ errorMessage = "SDNC returned a " + responseEntity.getStatusCode().value();
+ }
+ } catch (Exception e) {
+ logger.error("Error during External Task SDNC Post Service", e);
+ errorMessage = "Error during External Task SDNC Post Service: " + e.getMessage();
+ }
+
+ if (success) {
+ externalTaskService.complete(externalTask, variables);
+ logger.debug("The External Task {} was Successful", externalTask.getId());
+ } else {
+ if (externalTask.getRetries() == null) {
+ logger.debug("The External Task {} Failed, Setting Retries to Default Start Value {}",
+ externalTask.getId(), getRetrySequence().length);
+ externalTaskService.handleFailure(externalTask, errorMessage, "errorDetails", getRetrySequence().length,
+ 10000);
+ } else if (externalTask.getRetries() != null && externalTask.getRetries() - 1 == 0) {
+ logger.debug("The External Task {} Failed, All Retries Exhausted", externalTask.getId());
+ variables.put("errorMessage", errorMessage);
+ externalTaskService.handleBpmnError(externalTask, "SDNCWorkflowException", null, variables);
+ } else {
+ logger.debug("The External Task {} Failed, Decrementing Retries to {} with Retry Delay {}",
+ externalTask.getId(), externalTask.getRetries() - 1,
+ calculateRetryDelay(externalTask.getRetries()));
+ externalTaskService.handleFailure(externalTask, errorMessage, "errorDetails",
+ externalTask.getRetries() - 1, calculateRetryDelay(externalTask.getRetries()));
+ }
+ }
+ }
+
+ public void executeGetTask(ExternalTask externalTask, ExternalTaskService externalTaskService) {
+ logger.debug("Executing External Task SDNC Get Service");
+
+ }
+
+ private String buildJsonRequest(Object request) throws JsonProcessingException {
+ String jsonRequest = objMapper.writerWithDefaultPrettyPrinter().writeValueAsString(request);
+ return jsonRequest;
+ }
+
+ private HttpHeaders getHttpHeader() throws GeneralSecurityException {
+ HttpHeaders httpHeader = new HttpHeaders();
+ httpHeader.set("Authorization", getAuth());
+ httpHeader.setContentType(MediaType.APPLICATION_JSON);
+ List<MediaType> acceptMediaTypes = new ArrayList<>();
+ acceptMediaTypes.add(MediaType.APPLICATION_JSON);
+ acceptMediaTypes.add(MediaType.TEXT_PLAIN);
+ httpHeader.setAccept(acceptMediaTypes);
+ return httpHeader;
+ }
+
+ protected String getAuth() throws GeneralSecurityException {
+ String auth = CryptoUtils.decrypt(env.getProperty(Constants.SDNC_AUTH_PROP),
+ env.getProperty(Constants.ENCRYPTION_KEY_PROP));
+ return "Basic " + DatatypeConverter.printBase64Binary(auth.getBytes());
+ }
+
+}
diff --git a/adapters/mso-sdnc-adapter/src/main/java/org/onap/so/adapters/sdnc/tasks/TaskServices.java b/adapters/mso-sdnc-adapter/src/main/java/org/onap/so/adapters/sdnc/tasks/TaskServices.java
new file mode 100644
index 0000000000..fd95b44aee
--- /dev/null
+++ b/adapters/mso-sdnc-adapter/src/main/java/org/onap/so/adapters/sdnc/tasks/TaskServices.java
@@ -0,0 +1,57 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * ONAP - SO
+ * ================================================================================
+ * Copyright (C) 2019 AT&T Intellectual Property. All rights reserved.
+ * ================================================================================
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ * ============LICENSE_END=========================================================
+ */
+
+package org.onap.so.adapters.sdnc.tasks;
+
+import javax.annotation.PostConstruct;
+import org.camunda.bpm.client.ExternalTaskClient;
+import org.onap.so.utils.ExternalTaskServiceUtils;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.context.annotation.Profile;
+import org.springframework.stereotype.Component;
+
+@Component
+@Profile("!test")
+public class TaskServices {
+
+ @Autowired
+ private ExternalTaskServiceUtils externalTaskServiceUtils;
+
+ @Autowired
+ private SDNCService service;
+
+ @PostConstruct
+ public void post() throws Exception {
+ for (int i = 0; i < externalTaskServiceUtils.getMaxClients(); i++) {
+ ExternalTaskClient client = externalTaskServiceUtils.createExternalTaskClient();
+ client.subscribe("sdncPost").lockDuration(externalTaskServiceUtils.getLockDurationLong())
+ .handler(service::executePostTask).open();
+ }
+ }
+
+ @PostConstruct
+ public void get() throws Exception {
+ for (int i = 0; i < externalTaskServiceUtils.getMaxClients(); i++) {
+ ExternalTaskClient client = externalTaskServiceUtils.createExternalTaskClient();
+ client.subscribe("sdncGet").lockDuration(externalTaskServiceUtils.getLockDurationLong())
+ .handler(service::executeGetTask).open();
+ }
+ }
+}
diff --git a/adapters/mso-sdnc-adapter/src/test/java/org/onap/so/adapters/sdnc/tasks/SDNCServiceTest.java b/adapters/mso-sdnc-adapter/src/test/java/org/onap/so/adapters/sdnc/tasks/SDNCServiceTest.java
new file mode 100644
index 0000000000..386d83f87d
--- /dev/null
+++ b/adapters/mso-sdnc-adapter/src/test/java/org/onap/so/adapters/sdnc/tasks/SDNCServiceTest.java
@@ -0,0 +1,72 @@
+package org.onap.so.adapters.sdnc.tasks;
+
+import java.io.IOException;
+import java.net.URI;
+import java.nio.file.Files;
+import java.nio.file.Paths;
+import java.security.GeneralSecurityException;
+import java.util.HashMap;
+import org.camunda.bpm.client.task.ExternalTask;
+import org.camunda.bpm.client.task.ExternalTaskService;
+import org.junit.Test;
+import org.junit.runner.RunWith;
+import org.mockito.InjectMocks;
+import org.mockito.Mock;
+import org.mockito.Mockito;
+import org.mockito.Spy;
+import org.mockito.junit.MockitoJUnitRunner;
+import org.onap.so.logging.tasks.AuditMDCSetup;
+import org.springframework.core.env.Environment;
+import org.springframework.http.HttpEntity;
+import org.springframework.http.HttpMethod;
+import org.springframework.http.HttpStatus;
+import org.springframework.http.ResponseEntity;
+import org.springframework.web.client.RestTemplate;
+
+@RunWith(MockitoJUnitRunner.class)
+public class SDNCServiceTest {
+
+ private String RESOURCE_PATH = "src/test/resources";
+
+ @Mock
+ private ExternalTask mockExternalTask;
+
+ @Mock
+ private ExternalTaskService mockExternalTaskService;
+
+ @Mock
+ private AuditMDCSetup mdcSetup;
+
+ @Mock
+ private RestTemplate restTemplate;
+
+ @Mock
+ private ResponseEntity<Object> response;
+
+ @Mock
+ private Environment env;
+
+ @Spy
+ @InjectMocks
+ private SDNCService sdncService;
+
+ @Test
+ public void testExecutePostTask() throws IOException, GeneralSecurityException {
+ String payload = new String(Files.readAllBytes(Paths.get(RESOURCE_PATH + "/sdncRequest.json")));
+
+ Mockito.when(env.getProperty("org.onap.so.adapters.sdnc.sdncHost")).thenReturn("sdncHost");
+ Mockito.when(mockExternalTask.getVariable("sdncRequest")).thenReturn(payload);
+ Mockito.when(mockExternalTask.getVariable("sdncUri")).thenReturn("/sdnc/action");
+ Mockito.doReturn("Basic 123").when(sdncService).getAuth();
+ Mockito.when(restTemplate.exchange(Mockito.any(URI.class), Mockito.eq(HttpMethod.POST),
+ Mockito.any(HttpEntity.class), Mockito.eq(Object.class))).thenReturn(response);
+ Mockito.when(response.getStatusCode()).thenReturn(HttpStatus.ACCEPTED);
+ Mockito.doNothing().when(mockExternalTaskService).complete(Mockito.any(), Mockito.any());
+
+ sdncService.executePostTask(mockExternalTask, mockExternalTaskService);
+
+ Mockito.verify(mockExternalTaskService).complete(Mockito.eq(mockExternalTask), Mockito.eq(new HashMap<>()));
+
+ }
+
+}
diff --git a/adapters/mso-sdnc-adapter/src/test/resources/sdncRequest.json b/adapters/mso-sdnc-adapter/src/test/resources/sdncRequest.json
new file mode 100644
index 0000000000..879b9b3765
--- /dev/null
+++ b/adapters/mso-sdnc-adapter/src/test/resources/sdncRequest.json
@@ -0,0 +1,12 @@
+{
+ "request_control": {
+ "transaction_id": "migId",
+ "request_id": "reqId",
+ "invocation_id": "subReqId",
+ "async": true,
+ "callback_url": "host/callback"
+ },
+ "input": {
+ "id": "id"
+ }
+} \ No newline at end of file
diff --git a/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/client/exception/ExceptionBuilder.java b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/client/exception/ExceptionBuilder.java
index f40948fc49..7113386052 100644
--- a/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/client/exception/ExceptionBuilder.java
+++ b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/client/exception/ExceptionBuilder.java
@@ -207,7 +207,8 @@ public class ExceptionBuilder {
}
}
- public void buildAndThrowWorkflowException(DelegateExecution execution, int errorCode, String errorMessage) {
+ public void buildAndThrowWorkflowException(DelegateExecution execution, int errorCode, String errorMessage)
+ throws BpmnError {
buildWorkflowException(execution, errorCode, errorMessage);
logger.info("Throwing MSOWorkflowException");
@@ -372,8 +373,18 @@ public class ExceptionBuilder {
}
buildWorkflowException(execution, 500, workflowExceptionMessage.toString(), Components.OPENSTACK);
throw new BpmnError("MSOWorkflowException");
+ }
-
+ public void processSDNCException(DelegateExecution execution) {
+ logger.debug("Processing SDNC Exception");
+ String errorMessage = "";
+ try {
+ errorMessage = (String) execution.getVariable("errorMessage");
+ } catch (Exception e) {
+ logger.debug("Error while Processing SDNC Exception", e);
+ }
+ buildWorkflowException(execution, 500, errorMessage, ONAPComponents.SDNC);
+ throw new BpmnError("MSOWorkflowException");
}
public void processInventoryException(DelegateExecution execution) {
diff --git a/common/src/main/java/org/onap/so/constants/Status.java b/common/src/main/java/org/onap/so/constants/Status.java
index b460418f0f..67c5ff0d40 100644
--- a/common/src/main/java/org/onap/so/constants/Status.java
+++ b/common/src/main/java/org/onap/so/constants/Status.java
@@ -27,6 +27,7 @@ package org.onap.so.constants;
public enum Status {
PENDING,
IN_PROGRESS,
+ WAIT_COMPLETION_NOTIF,
COMPLETE,
COMPLETED,
FAILED,
diff --git a/common/src/main/java/org/onap/so/security/BaseWebSecurityConfigurerAdapter.java b/common/src/main/java/org/onap/so/security/BaseWebSecurityConfigurerAdapter.java
new file mode 100644
index 0000000000..f494a6b812
--- /dev/null
+++ b/common/src/main/java/org/onap/so/security/BaseWebSecurityConfigurerAdapter.java
@@ -0,0 +1,44 @@
+package org.onap.so.security;
+
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.security.config.annotation.authentication.builders.AuthenticationManagerBuilder;
+import org.springframework.security.config.annotation.web.builders.HttpSecurity;
+import org.springframework.security.config.annotation.web.builders.WebSecurity;
+import org.springframework.security.core.userdetails.UserDetailsService;
+import org.springframework.security.crypto.bcrypt.BCryptPasswordEncoder;
+import org.springframework.security.web.firewall.StrictHttpFirewall;
+import org.springframework.security.config.annotation.web.configuration.WebSecurityConfigurerAdapter;
+
+public abstract class BaseWebSecurityConfigurerAdapter extends WebSecurityConfigurerAdapter {
+ private static final Logger LOGGER = LoggerFactory.getLogger(BaseWebSecurityConfigurerAdapter.class);
+
+ @Autowired
+ protected UserDetailsService userDetailsService;
+
+ @Autowired
+ protected BCryptPasswordEncoder passwordEncoder;
+
+ abstract HttpSecurityConfigurer getHttpSecurityConfigurer();
+
+ @Override
+ protected void configure(final HttpSecurity http) throws Exception {
+ HttpSecurityConfigurer httpSecurityConfigurer = getHttpSecurityConfigurer();
+ LOGGER.debug("Injecting {} configuration ...", httpSecurityConfigurer.getClass());
+
+ httpSecurityConfigurer.configure(http);
+ }
+
+ @Override
+ public void configure(final WebSecurity web) throws Exception {
+ super.configure(web);
+ final StrictHttpFirewall firewall = new MSOSpringFirewall();
+ web.httpFirewall(firewall);
+ }
+
+ @Override
+ protected void configure(final AuthenticationManagerBuilder auth) throws Exception {
+ auth.userDetailsService(userDetailsService).passwordEncoder(passwordEncoder);
+ }
+}
diff --git a/common/src/main/java/org/onap/so/security/CorsBasicHttpSecurityConfigurer.java b/common/src/main/java/org/onap/so/security/CorsBasicHttpSecurityConfigurer.java
new file mode 100644
index 0000000000..27c998f87d
--- /dev/null
+++ b/common/src/main/java/org/onap/so/security/CorsBasicHttpSecurityConfigurer.java
@@ -0,0 +1,33 @@
+package org.onap.so.security;
+
+import org.springframework.context.annotation.Bean;
+import org.springframework.context.annotation.Profile;
+import org.springframework.security.config.annotation.web.builders.HttpSecurity;
+import org.springframework.stereotype.Component;
+import org.springframework.web.cors.CorsConfiguration;
+import org.springframework.web.cors.CorsConfigurationSource;
+import org.springframework.web.cors.UrlBasedCorsConfigurationSource;
+import java.util.Arrays;
+
+@Component("cors")
+@Profile({"cors"})
+public class CorsBasicHttpSecurityConfigurer implements HttpSecurityConfigurer {
+
+ @Override
+ public void configure(final HttpSecurity http) throws Exception {
+ http.cors().and().csrf().disable().authorizeRequests().antMatchers("/manage/health", "/manage/info").permitAll()
+ .antMatchers("/**").fullyAuthenticated().and().httpBasic();
+ }
+
+ @Bean
+ CorsConfigurationSource corsConfigurationSource() {
+ CorsConfiguration configuration = new CorsConfiguration();
+ configuration.setAllowedOrigins(Arrays.asList("*"));
+ configuration.setAllowedMethods(Arrays.asList("OPTIONS", "GET", "POST", "PATCH"));
+ configuration.setAllowCredentials(true);
+ configuration.setAllowedHeaders(Arrays.asList("*"));
+ UrlBasedCorsConfigurationSource source = new UrlBasedCorsConfigurationSource();
+ source.registerCorsConfiguration("/**", configuration);
+ return source;
+ }
+}
diff --git a/common/src/main/java/org/onap/so/security/CorsWebSecurityConfigurerAdapter.java b/common/src/main/java/org/onap/so/security/CorsWebSecurityConfigurerAdapter.java
new file mode 100644
index 0000000000..08ecd0c578
--- /dev/null
+++ b/common/src/main/java/org/onap/so/security/CorsWebSecurityConfigurerAdapter.java
@@ -0,0 +1,24 @@
+package org.onap.so.security;
+
+
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.beans.factory.annotation.Qualifier;
+import org.springframework.context.annotation.Configuration;
+import org.springframework.context.annotation.Profile;
+import org.springframework.core.annotation.Order;
+import org.springframework.security.config.annotation.web.configuration.EnableWebSecurity;
+
+@EnableWebSecurity
+@Configuration
+@Order(1)
+@Profile({"cors"})
+public class CorsWebSecurityConfigurerAdapter extends BaseWebSecurityConfigurerAdapter {
+ @Autowired
+ @Qualifier("cors")
+ protected HttpSecurityConfigurer httpSecurityConfigurer;
+
+ @Override
+ HttpSecurityConfigurer getHttpSecurityConfigurer() {
+ return httpSecurityConfigurer;
+ }
+}
diff --git a/common/src/main/java/org/onap/so/security/SoBasicHttpSecurityConfigurer.java b/common/src/main/java/org/onap/so/security/SoBasicHttpSecurityConfigurer.java
index 9aceb03519..da989ee42a 100644
--- a/common/src/main/java/org/onap/so/security/SoBasicHttpSecurityConfigurer.java
+++ b/common/src/main/java/org/onap/so/security/SoBasicHttpSecurityConfigurer.java
@@ -28,7 +28,7 @@ import org.springframework.util.StringUtils;
* @author Waqas Ikram (waqas.ikram@est.tech)
*
*/
-@Component
+@Component("basic")
public class SoBasicHttpSecurityConfigurer implements HttpSecurityConfigurer {
@Autowired
diff --git a/common/src/main/java/org/onap/so/security/SoWebSecurityConfigurerAdapter.java b/common/src/main/java/org/onap/so/security/SoWebSecurityConfigurerAdapter.java
index 903d586ab1..c14ae47d89 100644
--- a/common/src/main/java/org/onap/so/security/SoWebSecurityConfigurerAdapter.java
+++ b/common/src/main/java/org/onap/so/security/SoWebSecurityConfigurerAdapter.java
@@ -19,20 +19,12 @@
*/
package org.onap.so.security;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.beans.factory.annotation.Qualifier;
import org.springframework.context.annotation.Configuration;
import org.springframework.context.annotation.Profile;
import org.springframework.core.annotation.Order;
-import org.springframework.security.config.annotation.authentication.builders.AuthenticationManagerBuilder;
-import org.springframework.security.config.annotation.web.builders.HttpSecurity;
-import org.springframework.security.config.annotation.web.builders.WebSecurity;
import org.springframework.security.config.annotation.web.configuration.EnableWebSecurity;
-import org.springframework.security.config.annotation.web.configuration.WebSecurityConfigurerAdapter;
-import org.springframework.security.core.userdetails.UserDetailsService;
-import org.springframework.security.crypto.bcrypt.BCryptPasswordEncoder;
-import org.springframework.security.web.firewall.StrictHttpFirewall;
/**
* @author Waqas Ikram (waqas.ikram@est.tech)
@@ -42,34 +34,13 @@ import org.springframework.security.web.firewall.StrictHttpFirewall;
@Configuration
@Order(1)
@Profile({"basic", "test"})
-public class SoWebSecurityConfigurerAdapter extends WebSecurityConfigurerAdapter {
- private static final Logger LOGGER = LoggerFactory.getLogger(SoWebSecurityConfigurerAdapter.class);
-
- @Autowired
- private HttpSecurityConfigurer httpSecurityConfigurer;
-
+public class SoWebSecurityConfigurerAdapter extends BaseWebSecurityConfigurerAdapter {
@Autowired
- private UserDetailsService userDetailsService;
-
- @Autowired
- private BCryptPasswordEncoder passwordEncoder;
-
- @Override
- protected void configure(final HttpSecurity http) throws Exception {
- LOGGER.debug("Injecting {} configuration ...", httpSecurityConfigurer.getClass());
-
- httpSecurityConfigurer.configure(http);
- }
-
- @Override
- public void configure(final WebSecurity web) throws Exception {
- super.configure(web);
- final StrictHttpFirewall firewall = new MSOSpringFirewall();
- web.httpFirewall(firewall);
- }
+ @Qualifier("basic")
+ protected HttpSecurityConfigurer httpSecurityConfigurer;
@Override
- protected void configure(final AuthenticationManagerBuilder auth) throws Exception {
- auth.userDetailsService(userDetailsService).passwordEncoder(passwordEncoder);
+ HttpSecurityConfigurer getHttpSecurityConfigurer() {
+ return httpSecurityConfigurer;
}
}
diff --git a/mso-api-handlers/mso-api-handler-common/src/main/java/org/onap/so/apihandler/common/RequestClientParameter.java b/mso-api-handlers/mso-api-handler-common/src/main/java/org/onap/so/apihandler/common/RequestClientParameter.java
index 2101252ad0..b75411b9a8 100644
--- a/mso-api-handlers/mso-api-handler-common/src/main/java/org/onap/so/apihandler/common/RequestClientParameter.java
+++ b/mso-api-handlers/mso-api-handler-common/src/main/java/org/onap/so/apihandler/common/RequestClientParameter.java
@@ -46,6 +46,8 @@ public class RequestClientParameter {
private String instanceGroupId;
private boolean generateIdsOnly;
private String operationType;
+ private String migrationId;
+ private String circuitId;
private RequestClientParameter(Builder builder) {
requestId = builder.requestId;
@@ -71,6 +73,8 @@ public class RequestClientParameter {
instanceGroupId = builder.instanceGroupId;
generateIdsOnly = builder.generateIdsOnly;
operationType = builder.operationType;
+ migrationId = builder.migrationId;
+ circuitId = builder.circuitId;
}
public String getOperationType() {
@@ -169,6 +173,22 @@ public class RequestClientParameter {
this.generateIdsOnly = generateIdsOnly;
}
+ public String getMigrationId() {
+ return migrationId;
+ }
+
+ public void setMigrationId(String migrationId) {
+ this.migrationId = migrationId;
+ }
+
+ public String getCircuitId() {
+ return circuitId;
+ }
+
+ public void setCircuitId(String circuitId) {
+ this.circuitId = circuitId;
+ }
+
public static class Builder {
private String requestId;
private boolean isBaseVfModule = false;
@@ -193,6 +213,18 @@ public class RequestClientParameter {
private String instanceGroupId;
private boolean generateIdsOnly;
private String operationType;
+ private String migrationId;
+ private String circuitId;
+
+ public Builder setCircuitId(String circuitId) {
+ this.circuitId = circuitId;
+ return this;
+ }
+
+ public Builder setMigrationId(String migrationId) {
+ this.migrationId = migrationId;
+ return this;
+ }
public Builder setOperationType(String operationType) {
this.operationType = operationType;