aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorsaul.gill <saul.gill@est.tech>2024-06-19 10:49:38 +0100
committersaul.gill <saul.gill@est.tech>2024-06-19 10:49:40 +0100
commitbe79e86eb56d7d72c7504cee491b79498f78d6ba (patch)
treefa49d73feee44635ad1c60d4de18d5bf5e2c5f58
parent29d86f951b30f4941ee63b0d2badef810b856e53 (diff)
Refactor disable basic auth
Issue-ID: POLICY-5044 Change-Id: Ib9db9fddd5890458c8ec830cef465e9c884f7c40 Signed-off-by: saul.gill <saul.gill@est.tech>
-rw-r--r--runtime-acm/src/main/java/org/onap/policy/clamp/acm/runtime/config/SecurityConfig.java20
1 files changed, 10 insertions, 10 deletions
diff --git a/runtime-acm/src/main/java/org/onap/policy/clamp/acm/runtime/config/SecurityConfig.java b/runtime-acm/src/main/java/org/onap/policy/clamp/acm/runtime/config/SecurityConfig.java
index 2e75db12e..9d50fc739 100644
--- a/runtime-acm/src/main/java/org/onap/policy/clamp/acm/runtime/config/SecurityConfig.java
+++ b/runtime-acm/src/main/java/org/onap/policy/clamp/acm/runtime/config/SecurityConfig.java
@@ -45,16 +45,16 @@ public class SecurityConfig {
*/
@Bean
public SecurityFilterChain securityFilterChain(HttpSecurity http) throws Exception {
- http
- .httpBasic(Customizer.withDefaults())
- .authorizeHttpRequests(authorize -> {
- if (useBasicAuth) {
- authorize.anyRequest().authenticated();
- } else {
- authorize.anyRequest().permitAll();
- }
- })
- .csrf(AbstractHttpConfigurer::disable);
+ if (useBasicAuth) {
+ http
+ .httpBasic(Customizer.withDefaults())
+ .authorizeHttpRequests(authorize -> authorize.anyRequest().authenticated());
+ } else {
+ http
+ .authorizeHttpRequests(authorize -> authorize.anyRequest().permitAll());
+ }
+
+ http.csrf(AbstractHttpConfigurer::disable);
return http.build();
}
}