diff options
author | egernug <gerard.nugent@est.tech> | 2023-11-02 11:28:51 +0000 |
---|---|---|
committer | egernug <gerard.nugent@est.tech> | 2023-11-02 11:46:53 +0000 |
commit | 9a6f9215df1426a230137e829e14a1139533d66b (patch) | |
tree | 40c28465e82f8220d43eb364c80880c1e4650290 | |
parent | a12d2718699793285b9bc3a63ce3b99ca367c954 (diff) |
Sonar Fixes
Fixing deprecations in WebSecurityConfig and DmiConfiguration
Issue-ID: CPS-89
Signed-off-by: egernug <gerard.nugent@est.tech>
Change-Id: I4c6d10ff7ef174db2a6e93e5e6e4b2b0b97b12f6
-rw-r--r-- | src/main/java/org/onap/cps/ncmp/dmi/config/DmiConfiguration.java | 1 | ||||
-rw-r--r-- | src/main/java/org/onap/cps/ncmp/dmi/config/WebSecurityConfig.java | 15 |
2 files changed, 7 insertions, 9 deletions
diff --git a/src/main/java/org/onap/cps/ncmp/dmi/config/DmiConfiguration.java b/src/main/java/org/onap/cps/ncmp/dmi/config/DmiConfiguration.java index 18b22dbe..83ef6f89 100644 --- a/src/main/java/org/onap/cps/ncmp/dmi/config/DmiConfiguration.java +++ b/src/main/java/org/onap/cps/ncmp/dmi/config/DmiConfiguration.java @@ -81,7 +81,6 @@ public class DmiConfiguration { private void setCustomRequestFactoryToSupportPatch(final RestTemplate restTemplate) { final HttpComponentsClientHttpRequestFactory requestFactory = new HttpComponentsClientHttpRequestFactory(); requestFactory.setConnectTimeout(TIMEOUT); - requestFactory.setReadTimeout(TIMEOUT); restTemplate.setRequestFactory(requestFactory); } }
\ No newline at end of file diff --git a/src/main/java/org/onap/cps/ncmp/dmi/config/WebSecurityConfig.java b/src/main/java/org/onap/cps/ncmp/dmi/config/WebSecurityConfig.java index 11d2ae53..ac92cb4a 100644 --- a/src/main/java/org/onap/cps/ncmp/dmi/config/WebSecurityConfig.java +++ b/src/main/java/org/onap/cps/ncmp/dmi/config/WebSecurityConfig.java @@ -20,14 +20,13 @@ package org.onap.cps.ncmp.dmi.config; -import static org.springframework.security.config.Customizer.withDefaults; - import org.springframework.beans.factory.annotation.Autowired; 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.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; @@ -79,12 +78,12 @@ public class WebSecurityConfig { @SuppressWarnings("squid:S4502") public SecurityFilterChain filterChain(final HttpSecurity http) throws Exception { http - .httpBasic(withDefaults()) - .authorizeRequests() - .requestMatchers(permitUris).permitAll() - .anyRequest().authenticated() - .and() - .csrf((csrf) -> csrf.disable()); + .httpBasic(httpBasicCustomizer -> {}) + .authorizeHttpRequests(authorizeHttpRequestsCustomizer -> { + authorizeHttpRequestsCustomizer.requestMatchers(permitUris).permitAll(); + authorizeHttpRequestsCustomizer.anyRequest().authenticated(); + }) + .csrf(AbstractHttpConfigurer::disable); return http.build(); } |