From be79e86eb56d7d72c7504cee491b79498f78d6ba Mon Sep 17 00:00:00 2001 From: "saul.gill" Date: Wed, 19 Jun 2024 10:49:38 +0100 Subject: Refactor disable basic auth Issue-ID: POLICY-5044 Change-Id: Ib9db9fddd5890458c8ec830cef465e9c884f7c40 Signed-off-by: saul.gill --- .../clamp/acm/runtime/config/SecurityConfig.java | 20 ++++++++++---------- 1 file 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(); } } -- cgit 1.2.3-korg