From c93294c531185d56852772ddbb528ef3af2cbb77 Mon Sep 17 00:00:00 2001 From: emaclee Date: Wed, 18 Oct 2023 00:38:32 +0100 Subject: Fix Sonar code smells - Update deprecated methods in webSecurityCOnfig - Remove 'deprecated' tag on methods that are to be removed in EventsPublisher as they are still being used, methods with deprecated tag (for removal) must not be used Issue-ID: CPS-89 Signed-off-by: emaclee Change-Id: I104d4b3e362d22bb7fc020580de6cb4f390e54c9 --- .../main/java/org/onap/cps/config/WebSecurityConfig.java | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) (limited to 'cps-application') diff --git a/cps-application/src/main/java/org/onap/cps/config/WebSecurityConfig.java b/cps-application/src/main/java/org/onap/cps/config/WebSecurityConfig.java index 9b726ba75d..120e0f3658 100644 --- a/cps-application/src/main/java/org/onap/cps/config/WebSecurityConfig.java +++ b/cps-application/src/main/java/org/onap/cps/config/WebSecurityConfig.java @@ -27,6 +27,7 @@ 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.EnableWebSecurity; +import org.springframework.security.config.annotation.web.configurers.AbstractHttpConfigurer; import org.springframework.security.core.userdetails.User; import org.springframework.security.core.userdetails.UserDetails; import org.springframework.security.provisioning.InMemoryUserDetailsManager; @@ -76,20 +77,19 @@ public class WebSecurityConfig { @SuppressWarnings("squid:S4502") public SecurityFilterChain filterChain(final HttpSecurity http) throws Exception { http - .httpBasic() - .and() - .authorizeHttpRequests() - .requestMatchers(permitUris).permitAll() - .anyRequest().authenticated() - .and() - .csrf().disable(); + .httpBasic(httpBasicCustomizer -> {}) + .authorizeHttpRequests(authorizeHttpRequestsCustomizer -> { + authorizeHttpRequestsCustomizer.requestMatchers(permitUris).permitAll(); + authorizeHttpRequestsCustomizer.anyRequest().authenticated(); + }) + .csrf(AbstractHttpConfigurer::disable); return http.build(); } /** * In memory user authentication details. * - * @return in memory authetication + * @return in memory authentication */ @Bean public InMemoryUserDetailsManager userDetailsService() { -- cgit 1.2.3-korg