aboutsummaryrefslogtreecommitdiffstats
path: root/so-monitoring/so-monitoring-service/src/main
diff options
context:
space:
mode:
Diffstat (limited to 'so-monitoring/so-monitoring-service/src/main')
-rw-r--r--so-monitoring/so-monitoring-service/src/main/java/org/onap/so/monitoring/rest/api/SoMonitoringApplication.java3
-rw-r--r--so-monitoring/so-monitoring-service/src/main/java/org/onap/so/monitoring/rest/api/SoMonitoringController.java23
-rw-r--r--so-monitoring/so-monitoring-service/src/main/java/org/onap/so/monitoring/rest/api/UserController.java35
-rw-r--r--so-monitoring/so-monitoring-service/src/main/java/org/onap/so/monitoring/rest/api/WebApplicationConfig.java9
-rw-r--r--so-monitoring/so-monitoring-service/src/main/java/org/onap/so/monitoring/rest/api/WebSecurityConfigImpl.java39
-rw-r--r--so-monitoring/so-monitoring-service/src/main/resources/application.yaml6
6 files changed, 18 insertions, 97 deletions
diff --git a/so-monitoring/so-monitoring-service/src/main/java/org/onap/so/monitoring/rest/api/SoMonitoringApplication.java b/so-monitoring/so-monitoring-service/src/main/java/org/onap/so/monitoring/rest/api/SoMonitoringApplication.java
index 7c5a8965b7..aff4fecfdc 100644
--- a/so-monitoring/so-monitoring-service/src/main/java/org/onap/so/monitoring/rest/api/SoMonitoringApplication.java
+++ b/so-monitoring/so-monitoring-service/src/main/java/org/onap/so/monitoring/rest/api/SoMonitoringApplication.java
@@ -22,11 +22,12 @@ package org.onap.so.monitoring.rest.api;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
+import org.springframework.boot.autoconfigure.security.servlet.SecurityAutoConfiguration;
/**
* @author waqas.ikram@ericsson.com
*/
-@SpringBootApplication(scanBasePackages = {"org.onap"})
+@SpringBootApplication(scanBasePackages = {"org.onap"}, exclude = SecurityAutoConfiguration.class)
public class SoMonitoringApplication {
public static void main(String[] args) {
diff --git a/so-monitoring/so-monitoring-service/src/main/java/org/onap/so/monitoring/rest/api/SoMonitoringController.java b/so-monitoring/so-monitoring-service/src/main/java/org/onap/so/monitoring/rest/api/SoMonitoringController.java
index d48d18dad0..5a5a4143fa 100644
--- a/so-monitoring/so-monitoring-service/src/main/java/org/onap/so/monitoring/rest/api/SoMonitoringController.java
+++ b/so-monitoring/so-monitoring-service/src/main/java/org/onap/so/monitoring/rest/api/SoMonitoringController.java
@@ -19,6 +19,7 @@
*/
package org.onap.so.monitoring.rest.api;
+import com.google.common.base.Optional;
import java.util.List;
import java.util.Map;
import javax.ws.rs.GET;
@@ -39,12 +40,12 @@ import org.onap.so.monitoring.model.ProcessInstanceVariableDetail;
import org.onap.so.monitoring.model.SoInfraRequest;
import org.onap.so.monitoring.rest.service.CamundaProcessDataServiceProvider;
import org.onap.so.rest.exceptions.InvalidRestRequestException;
+import org.onap.so.rest.exceptions.HttpResouceNotFoundException;
import org.onap.so.rest.exceptions.RestProcessingException;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;
-import com.google.common.base.Optional;
/**
* @author waqas.ikram@ericsson.com
@@ -82,10 +83,10 @@ public class SoMonitoringController {
return Response.status(Status.OK).entity(processInstanceId.get()).build();
}
- LOGGER.error("Unable to find process instance id for : " + requestId);
+ LOGGER.error("Unable to find process instance id for : {} ", requestId);
return Response.status(Status.NO_CONTENT).build();
- } catch (final InvalidRestRequestException extensions) {
+ } catch (final InvalidRestRequestException | HttpResouceNotFoundException extensions) {
final String message = "Unable to find process instance id for : " + requestId;
LOGGER.error(message);
return Response.status(Status.BAD_REQUEST).entity(message).build();
@@ -111,10 +112,10 @@ public class SoMonitoringController {
return Response.status(Status.OK).entity(processInstanceDetail.get()).build();
}
- LOGGER.error("Unable to find process instance id for : " + processInstanceId);
+ LOGGER.error("Unable to find process instance id for : {}", processInstanceId);
return Response.status(Status.NO_CONTENT).build();
- } catch (final InvalidRestRequestException extensions) {
+ } catch (final InvalidRestRequestException | HttpResouceNotFoundException extensions) {
final String message = "Unable to find process instance id for : " + processInstanceId;
LOGGER.error(message);
return Response.status(Status.BAD_REQUEST).entity(message).build();
@@ -140,10 +141,10 @@ public class SoMonitoringController {
final ProcessDefinitionDetail definitionDetail = response.get();
return Response.status(Status.OK).entity(definitionDetail).build();
}
- LOGGER.error("Unable to find process definition xml for processDefinitionId: " + processDefinitionId);
+ LOGGER.error("Unable to find process definition xml for processDefinitionId: {}", processDefinitionId);
return Response.status(Status.NO_CONTENT).build();
- } catch (final InvalidRestRequestException extensions) {
+ } catch (final InvalidRestRequestException | HttpResouceNotFoundException extensions) {
final String message =
"Unable to find process definition xml for processDefinitionId: {}" + processDefinitionId;
return Response.status(Status.BAD_REQUEST).entity(message).build();
@@ -166,7 +167,7 @@ public class SoMonitoringController {
final List<ActivityInstanceDetail> activityInstanceDetails =
camundaProcessDataServiceProvider.getActivityInstance(processInstanceId);
return Response.status(Status.OK).entity(activityInstanceDetails).build();
- } catch (final InvalidRestRequestException extensions) {
+ } catch (final InvalidRestRequestException | HttpResouceNotFoundException extensions) {
final String message = "Unable to find activity instance for processInstanceId: " + processInstanceId;
LOGGER.error(message);
return Response.status(Status.BAD_REQUEST).entity(message).build();
@@ -189,7 +190,7 @@ public class SoMonitoringController {
final List<ProcessInstanceVariableDetail> processInstanceVariable =
camundaProcessDataServiceProvider.getProcessInstanceVariable(processInstanceId);
return Response.status(Status.OK).entity(processInstanceVariable).build();
- } catch (final InvalidRestRequestException extensions) {
+ } catch (final InvalidRestRequestException | HttpResouceNotFoundException extensions) {
final String message =
"Unable to find process instance variables for processInstanceId: " + processInstanceId;
LOGGER.error(message);
@@ -214,10 +215,10 @@ public class SoMonitoringController {
try {
final List<SoInfraRequest> requests =
databaseServiceProvider.getSoInfraRequest(filters, startTime, endTime, maxResult);
- LOGGER.info("result size: " + requests.size());
+ LOGGER.info("result size: {}", requests.size());
return Response.status(Status.OK).entity(requests).build();
- } catch (final InvalidRestRequestException extensions) {
+ } catch (final InvalidRestRequestException | HttpResouceNotFoundException extensions) {
final String message = "Unable to search request for filters: " + filters + ", from: " + startTime
+ ", to: " + endTime + ", maxResult: " + maxResult;
LOGGER.error(message);
diff --git a/so-monitoring/so-monitoring-service/src/main/java/org/onap/so/monitoring/rest/api/UserController.java b/so-monitoring/so-monitoring-service/src/main/java/org/onap/so/monitoring/rest/api/UserController.java
deleted file mode 100644
index 3959631f94..0000000000
--- a/so-monitoring/so-monitoring-service/src/main/java/org/onap/so/monitoring/rest/api/UserController.java
+++ /dev/null
@@ -1,35 +0,0 @@
-/*-
- * ============LICENSE_START=======================================================
- * Copyright (C) 2019 Samsung
- * ================================================================================
- * 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.
- *
- * SPDX-License-Identifier: Apache-2.0
- * ============LICENSE_END=========================================================
- */
-
-package org.onap.so.monitoring.rest.api;
-
-import java.security.Principal;
-import org.springframework.web.bind.annotation.CrossOrigin;
-import org.springframework.web.bind.annotation.RequestMapping;
-import org.springframework.web.bind.annotation.RestController;
-
-@RestController
-public class UserController {
-
- @RequestMapping("/user")
- public Principal user(Principal user) {
- return user;
- }
-}
diff --git a/so-monitoring/so-monitoring-service/src/main/java/org/onap/so/monitoring/rest/api/WebApplicationConfig.java b/so-monitoring/so-monitoring-service/src/main/java/org/onap/so/monitoring/rest/api/WebApplicationConfig.java
index 2b53ed8953..cadd60b0d9 100644
--- a/so-monitoring/so-monitoring-service/src/main/java/org/onap/so/monitoring/rest/api/WebApplicationConfig.java
+++ b/so-monitoring/so-monitoring-service/src/main/java/org/onap/so/monitoring/rest/api/WebApplicationConfig.java
@@ -2,9 +2,7 @@
* ============LICENSE_START=======================================================
* Copyright (C) 2018 Ericsson. All rights reserved.
* ================================================================================
- * Modifications Copyright (c) 2019 Samsung
- * ================================================================================
- * Licensed under the Apache License, Version 2.0 (the "License");
+ * 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
*
@@ -23,15 +21,16 @@ package org.onap.so.monitoring.rest.api;
import org.springframework.context.annotation.Configuration;
import org.springframework.web.servlet.config.annotation.ViewControllerRegistry;
-import org.springframework.web.servlet.config.annotation.WebMvcConfigurer;
+import org.springframework.web.servlet.config.annotation.WebMvcConfigurerAdapter;
/**
* @author waqas.ikram@ericsson.com
*/
@Configuration
-public class WebApplicationConfig implements WebMvcConfigurer {
+public class WebApplicationConfig extends WebMvcConfigurerAdapter {
@Override
public void addViewControllers(final ViewControllerRegistry registry) {
+ super.addViewControllers(registry);
registry.addViewController("/details/**").setViewName("forward:/");
}
}
diff --git a/so-monitoring/so-monitoring-service/src/main/java/org/onap/so/monitoring/rest/api/WebSecurityConfigImpl.java b/so-monitoring/so-monitoring-service/src/main/java/org/onap/so/monitoring/rest/api/WebSecurityConfigImpl.java
deleted file mode 100644
index 298f52bd35..0000000000
--- a/so-monitoring/so-monitoring-service/src/main/java/org/onap/so/monitoring/rest/api/WebSecurityConfigImpl.java
+++ /dev/null
@@ -1,39 +0,0 @@
-/*-
- * ============LICENSE_START=======================================================
- * Copyright (C) 2019 Samsung
- * ================================================================================
- * 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.
- *
- * SPDX-License-Identifier: Apache-2.0
- * ============LICENSE_END=========================================================
- */
-
-package org.onap.so.monitoring.rest.api;
-
-import org.onap.so.security.WebSecurityConfig;
-import org.springframework.context.annotation.Configuration;
-import org.springframework.core.annotation.Order;
-import org.springframework.security.config.annotation.web.builders.HttpSecurity;
-import org.springframework.security.config.annotation.web.configuration.EnableWebSecurity;
-
-@EnableWebSecurity
-@Configuration("att-security-config")
-@Order(2)
-public class WebSecurityConfigImpl extends WebSecurityConfig {
-
- @Override
- protected void configure(HttpSecurity http) throws Exception {
- http.authorizeRequests().antMatchers("/actuator", "/actuator/*", "/login", "/", "/index.html", "/*.js",
- "/*.js.map", "/favicon.png").permitAll().anyRequest().authenticated().and().httpBasic();
- }
-}
diff --git a/so-monitoring/so-monitoring-service/src/main/resources/application.yaml b/so-monitoring/so-monitoring-service/src/main/resources/application.yaml
index 417febebf6..dbccb76979 100644
--- a/so-monitoring/so-monitoring-service/src/main/resources/application.yaml
+++ b/so-monitoring/so-monitoring-service/src/main/resources/application.yaml
@@ -19,9 +19,3 @@ mso:
spring:
main:
allow-bean-definition-overriding: true
- security:
- usercredentials:
- -
- username: gui
- password: '$2a$10$Fh9ffgPw2vnmsghsRD3ZauBL1aKXebigbq3BB1RPWtE62UDILsjke'
- role: GUI-Client