diff options
author | emaclee <lee.anjella.macabuhay@est.tech> | 2023-10-18 00:38:32 +0100 |
---|---|---|
committer | emaclee <lee.anjella.macabuhay@est.tech> | 2023-10-18 00:58:31 +0100 |
commit | c93294c531185d56852772ddbb528ef3af2cbb77 (patch) | |
tree | bd3f7354fb9d73e00cea703e04979922ef00a186 /cps-application/src | |
parent | ecfb5ee60ec54a2b3f789dc9436f6db4c830e3e8 (diff) |
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 <lee.anjella.macabuhay@est.tech>
Change-Id: I104d4b3e362d22bb7fc020580de6cb4f390e54c9
Diffstat (limited to 'cps-application/src')
-rw-r--r-- | cps-application/src/main/java/org/onap/cps/config/WebSecurityConfig.java | 16 |
1 files changed, 8 insertions, 8 deletions
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() { |