summaryrefslogtreecommitdiffstats
path: root/participant/participant-impl/participant-impl-a1pms
diff options
context:
space:
mode:
Diffstat (limited to 'participant/participant-impl/participant-impl-a1pms')
-rwxr-xr-xparticipant/participant-impl/participant-impl-a1pms/src/main/java/org/onap/policy/clamp/acm/participant/a1pms/config/SecurityConfig.java42
-rwxr-xr-xparticipant/participant-impl/participant-impl-a1pms/src/main/java/org/onap/policy/clamp/acm/participant/a1pms/exception/A1PolicyServiceException.java3
-rwxr-xr-xparticipant/participant-impl/participant-impl-a1pms/src/test/java/org/onap/policy/clamp/acm/participant/a1pms/rest/ActuatorControllerTest.java4
3 files changed, 26 insertions, 23 deletions
diff --git a/participant/participant-impl/participant-impl-a1pms/src/main/java/org/onap/policy/clamp/acm/participant/a1pms/config/SecurityConfig.java b/participant/participant-impl/participant-impl-a1pms/src/main/java/org/onap/policy/clamp/acm/participant/a1pms/config/SecurityConfig.java
index fdbbc4558..9a62e0b30 100755
--- a/participant/participant-impl/participant-impl-a1pms/src/main/java/org/onap/policy/clamp/acm/participant/a1pms/config/SecurityConfig.java
+++ b/participant/participant-impl/participant-impl-a1pms/src/main/java/org/onap/policy/clamp/acm/participant/a1pms/config/SecurityConfig.java
@@ -1,6 +1,6 @@
/*-
* ========================LICENSE_START=================================
- * Copyright (C) 2022 Nordix Foundation. All rights reserved.
+ * Copyright (C) 2022-2023 Nordix Foundation.
* ======================================================================
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -18,28 +18,30 @@
package org.onap.policy.clamp.acm.participant.a1pms.config;
-import org.springframework.beans.factory.annotation.Value;
+import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.security.config.annotation.web.builders.HttpSecurity;
-import org.springframework.security.config.annotation.web.configuration.WebSecurityConfigurerAdapter;
+import org.springframework.security.web.SecurityFilterChain;
+/**
+ * Configure how access to this module's REST end points is secured.
+ */
@Configuration
-public class SecurityConfig extends WebSecurityConfigurerAdapter {
-
- @Value("${security.enable-csrf:true}")
- private boolean csrfEnabled = true;
-
- @Override
- protected void configure(HttpSecurity http) throws Exception {
- // @formatter:off
- http.authorizeRequests()
- .antMatchers().authenticated()
- .anyRequest().authenticated()
- .and().httpBasic();
- // @formatter:on
-
- if (!csrfEnabled) {
- http.csrf().disable();
- }
+public class SecurityConfig {
+ /**
+ * Return the configuration of how access to this module's REST end points is secured.
+ *
+ * @param http the HTTP security settings
+ * @return the HTTP security settings
+ */
+ @Bean
+ public SecurityFilterChain securityFilterChain(HttpSecurity http) throws Exception {
+ http
+ .httpBasic()
+ .and()
+ .authorizeHttpRequests().anyRequest().authenticated()
+ .and()
+ .csrf().disable();
+ return http.build();
}
}
diff --git a/participant/participant-impl/participant-impl-a1pms/src/main/java/org/onap/policy/clamp/acm/participant/a1pms/exception/A1PolicyServiceException.java b/participant/participant-impl/participant-impl-a1pms/src/main/java/org/onap/policy/clamp/acm/participant/a1pms/exception/A1PolicyServiceException.java
index 3a7ac7d9f..b01e451c0 100755
--- a/participant/participant-impl/participant-impl-a1pms/src/main/java/org/onap/policy/clamp/acm/participant/a1pms/exception/A1PolicyServiceException.java
+++ b/participant/participant-impl/participant-impl-a1pms/src/main/java/org/onap/policy/clamp/acm/participant/a1pms/exception/A1PolicyServiceException.java
@@ -1,6 +1,6 @@
/*-
* ============LICENSE_START=======================================================
- * Copyright (C) 2022 Nordix Foundation.
+ * Copyright (C) 2022-2023 Nordix Foundation.
* ================================================================================
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -24,6 +24,7 @@ import javax.ws.rs.core.Response;
import org.onap.policy.models.base.PfModelException;
public class A1PolicyServiceException extends PfModelException {
+ private static final long serialVersionUID = 6438746904567105054L;
public A1PolicyServiceException(int statusCode, String message) {
super(Response.Status.fromStatusCode(statusCode), message);
diff --git a/participant/participant-impl/participant-impl-a1pms/src/test/java/org/onap/policy/clamp/acm/participant/a1pms/rest/ActuatorControllerTest.java b/participant/participant-impl/participant-impl-a1pms/src/test/java/org/onap/policy/clamp/acm/participant/a1pms/rest/ActuatorControllerTest.java
index 831dc5e77..98d001e4a 100755
--- a/participant/participant-impl/participant-impl-a1pms/src/test/java/org/onap/policy/clamp/acm/participant/a1pms/rest/ActuatorControllerTest.java
+++ b/participant/participant-impl/participant-impl-a1pms/src/test/java/org/onap/policy/clamp/acm/participant/a1pms/rest/ActuatorControllerTest.java
@@ -1,6 +1,6 @@
/*-
* ============LICENSE_START=======================================================
- * Copyright (C) 2022 Nordix Foundation.
+ * Copyright (C) 2022-2023 Nordix Foundation.
* ================================================================================
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -31,7 +31,7 @@ import org.onap.policy.clamp.acm.participant.a1pms.utils.CommonActuatorControlle
import org.springframework.boot.test.autoconfigure.actuate.metrics.AutoConfigureMetrics;
import org.springframework.boot.test.context.SpringBootTest;
import org.springframework.boot.test.context.SpringBootTest.WebEnvironment;
-import org.springframework.boot.web.server.LocalServerPort;
+import org.springframework.boot.test.web.server.LocalServerPort;
import org.springframework.test.context.ActiveProfiles;
import org.springframework.test.context.junit.jupiter.SpringExtension;