summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--adapters/mso-ve-vnfm-adapter/src/main/java/org/onap/so/adapters/vevnfm/Application.java6
-rw-r--r--adapters/mso-ve-vnfm-adapter/src/main/java/org/onap/so/adapters/vevnfm/configuration/SecurityConfiguration.java58
-rw-r--r--adapters/mso-ve-vnfm-adapter/src/main/java/org/onap/so/adapters/vevnfm/service/SubscriberService.java12
-rw-r--r--adapters/mso-ve-vnfm-adapter/src/main/resources/application.yaml8
-rw-r--r--bpmn/so-bpmn-building-blocks/src/main/resources/subprocess/BuildingBlock/AssignPnfBB.bpmn41
-rw-r--r--bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/aai/tasks/AAIUpdateTasks.java9
-rw-r--r--bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/aai/tasks/AAIUpdateTasksTest.java19
-rw-r--r--common/src/main/java/org/onap/so/security/SoBasicWebSecurityConfigurerAdapter.java12
8 files changed, 80 insertions, 85 deletions
diff --git a/adapters/mso-ve-vnfm-adapter/src/main/java/org/onap/so/adapters/vevnfm/Application.java b/adapters/mso-ve-vnfm-adapter/src/main/java/org/onap/so/adapters/vevnfm/Application.java
index e4a6bed300..875fddd7f0 100644
--- a/adapters/mso-ve-vnfm-adapter/src/main/java/org/onap/so/adapters/vevnfm/Application.java
+++ b/adapters/mso-ve-vnfm-adapter/src/main/java/org/onap/so/adapters/vevnfm/Application.java
@@ -26,7 +26,11 @@ import org.springframework.boot.autoconfigure.SpringBootApplication;
@SpringBootApplication(scanBasePackages = {"org.onap.so"})
public class Application {
+ public static final String BASIC_PROFILE = "basic";
+
public static void main(final String... args) {
- SpringApplication.run(Application.class, args);
+ final SpringApplication springApplication = new SpringApplication(Application.class);
+ springApplication.setAdditionalProfiles(BASIC_PROFILE);
+ springApplication.run(args);
}
}
diff --git a/adapters/mso-ve-vnfm-adapter/src/main/java/org/onap/so/adapters/vevnfm/configuration/SecurityConfiguration.java b/adapters/mso-ve-vnfm-adapter/src/main/java/org/onap/so/adapters/vevnfm/configuration/SecurityConfiguration.java
deleted file mode 100644
index cc56048262..0000000000
--- a/adapters/mso-ve-vnfm-adapter/src/main/java/org/onap/so/adapters/vevnfm/configuration/SecurityConfiguration.java
+++ /dev/null
@@ -1,58 +0,0 @@
-/*-
- * ============LICENSE_START=======================================================
- * SO
- * ================================================================================
- * Copyright (C) 2020 Samsung. 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.vevnfm.configuration;
-
-import org.onap.so.security.SoBasicWebSecurityConfigurerAdapter;
-import org.springframework.beans.factory.annotation.Autowired;
-import org.springframework.beans.factory.annotation.Value;
-import org.springframework.context.annotation.Configuration;
-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.configuration.EnableWebSecurity;
-import org.springframework.security.crypto.password.PasswordEncoder;
-
-@Configuration
-@EnableWebSecurity
-public class SecurityConfiguration extends SoBasicWebSecurityConfigurerAdapter {
-
- @Value("${notification.url}")
- private String notificationUrl;
-
- @Value("${notification.username}")
- private String notificationUsername;
-
- @Value("${notification.password}")
- private String notificationPassword;
-
- @Autowired
- private PasswordEncoder passwordEncoder;
-
- @Override
- protected void configure(final HttpSecurity https) throws Exception {
- https.csrf().disable().authorizeRequests().antMatchers(notificationUrl).authenticated().and().httpBasic();
- }
-
- @Override
- protected void configure(final AuthenticationManagerBuilder auth) throws Exception {
- auth.inMemoryAuthentication().withUser(notificationUsername)
- .password(passwordEncoder.encode(notificationPassword)).authorities("ROLE_USER");
- }
-}
diff --git a/adapters/mso-ve-vnfm-adapter/src/main/java/org/onap/so/adapters/vevnfm/service/SubscriberService.java b/adapters/mso-ve-vnfm-adapter/src/main/java/org/onap/so/adapters/vevnfm/service/SubscriberService.java
index aa07ed65a2..c1a56fb452 100644
--- a/adapters/mso-ve-vnfm-adapter/src/main/java/org/onap/so/adapters/vevnfm/service/SubscriberService.java
+++ b/adapters/mso-ve-vnfm-adapter/src/main/java/org/onap/so/adapters/vevnfm/service/SubscriberService.java
@@ -43,11 +43,11 @@ public class SubscriberService {
@Value("${notification.url}")
private String notificationUrl;
- @Value("${notification.username}")
- private String notificationUsername;
+ @Value("${spring.security.usercredentials[0].username}")
+ private String username;
- @Value("${notification.password}")
- private String notificationPassword;
+ @Value("${spring.security.usercredentials[0].openpass}")
+ private String openpass;
@Autowired
private SubscribeSender sender;
@@ -62,8 +62,8 @@ public class SubscriberService {
request.callbackUri(getCallbackUri());
final SubscriptionsAuthenticationParamsBasic paramsBasic = new SubscriptionsAuthenticationParamsBasic();
final SubscriptionsAuthentication authentication = new SubscriptionsAuthentication();
- paramsBasic.setUserName(notificationUsername);
- paramsBasic.setPassword(notificationPassword);
+ paramsBasic.setUserName(username);
+ paramsBasic.setPassword(openpass);
authentication.setAuthType(Collections.singletonList(SubscriptionsAuthentication.AuthTypeEnum.BASIC));
authentication.setParamsBasic(paramsBasic);
request.authentication(authentication);
diff --git a/adapters/mso-ve-vnfm-adapter/src/main/resources/application.yaml b/adapters/mso-ve-vnfm-adapter/src/main/resources/application.yaml
index b16fa6348f..f3ad9615ec 100644
--- a/adapters/mso-ve-vnfm-adapter/src/main/resources/application.yaml
+++ b/adapters/mso-ve-vnfm-adapter/src/main/resources/application.yaml
@@ -22,8 +22,6 @@ system:
notification:
url: /lcm/v1/vnf/instances/notifications
- username: admin
- password: a4b3c2d1
mso:
key: 07a7159d3bf51a0e53be7a8f89699be7
@@ -36,6 +34,12 @@ vnfm:
subscription: /vnflcm/v1/subscriptions
spring:
+ security:
+ usercredentials:
+ - username: admin
+ openpass: a4b3c2d1
+ password: '$2a$10$vU.mWyNTsikAxXIA5c269ewCpAbYTiyMS0m1N.kn4F2CSGEnrKN7K'
+ role: USER
http:
converters:
preferred-json-mapper: gson
diff --git a/bpmn/so-bpmn-building-blocks/src/main/resources/subprocess/BuildingBlock/AssignPnfBB.bpmn b/bpmn/so-bpmn-building-blocks/src/main/resources/subprocess/BuildingBlock/AssignPnfBB.bpmn
index c8600586ce..1b4470b545 100644
--- a/bpmn/so-bpmn-building-blocks/src/main/resources/subprocess/BuildingBlock/AssignPnfBB.bpmn
+++ b/bpmn/so-bpmn-building-blocks/src/main/resources/subprocess/BuildingBlock/AssignPnfBB.bpmn
@@ -1,34 +1,38 @@
<?xml version="1.0" encoding="UTF-8"?>
-<bpmn:definitions xmlns:bpmn="http://www.omg.org/spec/BPMN/20100524/MODEL" xmlns:bpmndi="http://www.omg.org/spec/BPMN/20100524/DI" xmlns:dc="http://www.omg.org/spec/DD/20100524/DC" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:camunda="http://camunda.org/schema/1.0/bpmn" xmlns:di="http://www.omg.org/spec/DD/20100524/DI" id="Definitions_1a52v2f" targetNamespace="http://bpmn.io/schema/bpmn" exporter="Camunda Modeler" exporterVersion="2.0.3">
+<bpmn:definitions xmlns:bpmn="http://www.omg.org/spec/BPMN/20100524/MODEL" xmlns:bpmndi="http://www.omg.org/spec/BPMN/20100524/DI" xmlns:dc="http://www.omg.org/spec/DD/20100524/DC" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:camunda="http://camunda.org/schema/1.0/bpmn" xmlns:di="http://www.omg.org/spec/DD/20100524/DI" id="Definitions_1a52v2f" targetNamespace="http://bpmn.io/schema/bpmn" exporter="Camunda Modeler" exporterVersion="3.5.0">
<bpmn:collaboration id="Collaboration_0go8wi3">
<bpmn:participant id="Participant_1dwc5st" name="SO&#10;Assign PNF" processRef="AssignPnfBB" />
<bpmn:participant id="Participant_0gycee4" name="AAI" />
<bpmn:messageFlow id="MessageFlow_0xh6bkn" sourceRef="CreatePnfEntryInAai" targetRef="Participant_0gycee4" />
</bpmn:collaboration>
<bpmn:process id="AssignPnfBB" name="AssignPnfBB" isExecutable="true">
- <bpmn:sequenceFlow id="SequenceFlow_0l6rtzy" sourceRef="CreatePnfEntryInAai" targetRef="AaiEntryExists" />
<bpmn:sequenceFlow id="SequenceFlow_1fu9o4x" sourceRef="AssignPnf_StartEvent" targetRef="CreatePnfEntryInAai" />
- <bpmn:endEvent id="AaiEntryExists" name="AAI entry exists">
- <bpmn:incoming>SequenceFlow_0l6rtzy</bpmn:incoming>
- </bpmn:endEvent>
<bpmn:serviceTask id="CreatePnfEntryInAai" name="Create Pnf entry in AAI" camunda:expression="${AAICreateTasks.createPnf(InjectExecution.execute(execution, execution.getVariable(&#34;gBuildingBlockExecution&#34;)))}">
<bpmn:incoming>SequenceFlow_1fu9o4x</bpmn:incoming>
- <bpmn:outgoing>SequenceFlow_0l6rtzy</bpmn:outgoing>
+ <bpmn:outgoing>SequenceFlow_0yrabnf</bpmn:outgoing>
</bpmn:serviceTask>
<bpmn:startEvent id="AssignPnf_StartEvent">
<bpmn:outgoing>SequenceFlow_1fu9o4x</bpmn:outgoing>
</bpmn:startEvent>
+ <bpmn:sequenceFlow id="SequenceFlow_0yrabnf" sourceRef="CreatePnfEntryInAai" targetRef="Task_UpdatePnfOrchestrationStatusAssigned" />
+ <bpmn:sequenceFlow id="SequenceFlow_1yb16sd" sourceRef="Task_UpdatePnfOrchestrationStatusAssigned" targetRef="AaiEntryExists" />
+ <bpmn:serviceTask id="Task_UpdatePnfOrchestrationStatusAssigned" name="Update Pnf Orchestration Status to Assigned" camunda:expression="${AAIUpdateTasks.updateOrchestrationStatusAssignedPnf(InjectExecution.execute(execution, execution.getVariable(&#34;gBuildingBlockExecution&#34;)))}">
+ <bpmn:incoming>SequenceFlow_0yrabnf</bpmn:incoming>
+ <bpmn:outgoing>SequenceFlow_1yb16sd</bpmn:outgoing>
+ </bpmn:serviceTask>
+ <bpmn:endEvent id="AaiEntryExists" name="AAI entry exists">
+ <bpmn:incoming>SequenceFlow_1yb16sd</bpmn:incoming>
+ </bpmn:endEvent>
<bpmn:association id="Association_1le3nwi" sourceRef="AssignPnf_StartEvent" targetRef="TextAnnotation_184cxp4" />
<bpmn:textAnnotation id="TextAnnotation_184cxp4">
<bpmn:text>Inputs:
- - pnfName - String
-</bpmn:text>
+ - pnfName - String</bpmn:text>
</bpmn:textAnnotation>
</bpmn:process>
<bpmndi:BPMNDiagram id="BPMNDiagram_1">
<bpmndi:BPMNPlane id="BPMNPlane_1" bpmnElement="Collaboration_0go8wi3">
<bpmndi:BPMNShape id="Participant_1dwc5st_di" bpmnElement="Participant_1dwc5st" isHorizontal="true">
- <dc:Bounds x="160" y="80" width="646" height="391" />
+ <dc:Bounds x="160" y="80" width="738" height="391" />
</bpmndi:BPMNShape>
<bpmndi:BPMNShape id="Participant_0gycee4_di" bpmnElement="Participant_0gycee4" isHorizontal="true">
<dc:Bounds x="260" y="567" width="502" height="60" />
@@ -51,19 +55,26 @@
<di:waypoint x="237" y="203" />
</bpmndi:BPMNEdge>
<bpmndi:BPMNShape id="EndEvent_1wfgsdz_di" bpmnElement="AaiEntryExists">
- <dc:Bounds x="722" y="269" width="36" height="36" />
+ <dc:Bounds x="772" y="269" width="36" height="36" />
<bpmndi:BPMNLabel>
- <dc:Bounds x="703" y="312" width="77" height="14" />
+ <dc:Bounds x="753" y="312" width="77" height="14" />
</bpmndi:BPMNLabel>
</bpmndi:BPMNShape>
- <bpmndi:BPMNEdge id="SequenceFlow_0l6rtzy_di" bpmnElement="SequenceFlow_0l6rtzy">
- <di:waypoint x="561" y="287" />
- <di:waypoint x="722" y="287" />
- </bpmndi:BPMNEdge>
<bpmndi:BPMNEdge id="SequenceFlow_1fu9o4x_di" bpmnElement="SequenceFlow_1fu9o4x">
<di:waypoint x="255" y="287" />
<di:waypoint x="461" y="287" />
</bpmndi:BPMNEdge>
+ <bpmndi:BPMNEdge id="SequenceFlow_0yrabnf_di" bpmnElement="SequenceFlow_0yrabnf">
+ <di:waypoint x="561" y="287" />
+ <di:waypoint x="620" y="287" />
+ </bpmndi:BPMNEdge>
+ <bpmndi:BPMNShape id="ServiceTask_1kmas9h_di" bpmnElement="Task_UpdatePnfOrchestrationStatusAssigned">
+ <dc:Bounds x="620" y="247" width="100" height="80" />
+ </bpmndi:BPMNShape>
+ <bpmndi:BPMNEdge id="SequenceFlow_1yb16sd_di" bpmnElement="SequenceFlow_1yb16sd">
+ <di:waypoint x="720" y="287" />
+ <di:waypoint x="772" y="287" />
+ </bpmndi:BPMNEdge>
</bpmndi:BPMNPlane>
</bpmndi:BPMNDiagram>
</bpmn:definitions>
diff --git a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/aai/tasks/AAIUpdateTasks.java b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/aai/tasks/AAIUpdateTasks.java
index dab35931f2..4d5494d18c 100644
--- a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/aai/tasks/AAIUpdateTasks.java
+++ b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/aai/tasks/AAIUpdateTasks.java
@@ -119,6 +119,15 @@ public class AAIUpdateTasks {
}
/**
+ * BPMN access method to update status of Pnf to Assigned in AAI
+ *
+ * @param execution
+ */
+ public void updateOrchestrationStatusAssignedPnf(BuildingBlockExecution execution) {
+ updateOrchestrationStatusForPnf(execution, OrchestrationStatus.ASSIGNED);
+ }
+
+ /**
* BPMN access method to update status of Pnf to Active in AAI
*
* @param execution
diff --git a/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/aai/tasks/AAIUpdateTasksTest.java b/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/aai/tasks/AAIUpdateTasksTest.java
index 19877aae16..e26009a1de 100644
--- a/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/aai/tasks/AAIUpdateTasksTest.java
+++ b/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/aai/tasks/AAIUpdateTasksTest.java
@@ -139,6 +139,25 @@ public class AAIUpdateTasksTest extends BaseTaskTest {
aaiUpdateTasks.updateOrchestrationStatusActiveService(execution);
}
+ @Test
+ public void updateOrchestrationStatusAssignedPnfTest() throws Exception {
+ Pnf pnf = preparePnfAndExtractForPnf();
+ doNothing().when(aaiPnfResources).updateOrchestrationStatusPnf(pnf, OrchestrationStatus.ASSIGNED);
+
+ aaiUpdateTasks.updateOrchestrationStatusAssignedPnf(execution);
+
+ verify(aaiPnfResources, times(1)).updateOrchestrationStatusPnf(pnf, OrchestrationStatus.ASSIGNED);
+ }
+
+ @Test
+ public void updateOrchestrationStatusAssignedPnfExceptionTest() throws Exception {
+ Pnf pnf = preparePnfAndExtractForPnf();
+ doThrow(RuntimeException.class).when(aaiPnfResources).updateOrchestrationStatusPnf(pnf,
+ OrchestrationStatus.ASSIGNED);
+
+ expectedException.expect(BpmnError.class);
+ aaiUpdateTasks.updateOrchestrationStatusAssignedPnf(execution);
+ }
@Test
public void updateOrchestrationStatusActivePnfTest() throws Exception {
diff --git a/common/src/main/java/org/onap/so/security/SoBasicWebSecurityConfigurerAdapter.java b/common/src/main/java/org/onap/so/security/SoBasicWebSecurityConfigurerAdapter.java
index c778dde9af..21176e0d5d 100644
--- a/common/src/main/java/org/onap/so/security/SoBasicWebSecurityConfigurerAdapter.java
+++ b/common/src/main/java/org/onap/so/security/SoBasicWebSecurityConfigurerAdapter.java
@@ -28,6 +28,8 @@ 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;
import org.springframework.util.StringUtils;
@@ -44,6 +46,12 @@ public class SoBasicWebSecurityConfigurerAdapter extends WebSecurityConfigurerAd
@Autowired
private SoUserCredentialConfiguration soUserCredentialConfiguration;
+ @Autowired
+ private UserDetailsService userDetailsService;
+
+ @Autowired
+ private BCryptPasswordEncoder passwordEncoder;
+
@Override
protected void configure(final HttpSecurity http) throws Exception {
http.csrf().disable().authorizeRequests().antMatchers("/manage/health", "/manage/info").permitAll()
@@ -61,8 +69,6 @@ public class SoBasicWebSecurityConfigurerAdapter extends WebSecurityConfigurerAd
@Override
protected void configure(final AuthenticationManagerBuilder auth) throws Exception {
- auth.userDetailsService(soUserCredentialConfiguration.userDetailsService())
- .passwordEncoder(soUserCredentialConfiguration.passwordEncoder());
+ auth.userDetailsService(userDetailsService).passwordEncoder(passwordEncoder);
}
-
}