From 54e4233ae8aaeb403205842cc26e448ff8e6cda9 Mon Sep 17 00:00:00 2001 From: Roman Strobl Date: Wed, 14 Aug 2024 14:06:52 +0200 Subject: [PATCH 1/2] Fix #316: JavaDoc warnings --- .../wultra/core/http/common/headers/UserAgent.java | 3 +++ .../rest/client/base/config/WebSecurityConfig.java | 14 +++++++++----- 2 files changed, 12 insertions(+), 5 deletions(-) diff --git a/http-common/src/main/java/com/wultra/core/http/common/headers/UserAgent.java b/http-common/src/main/java/com/wultra/core/http/common/headers/UserAgent.java index 08d328b..9134363 100644 --- a/http-common/src/main/java/com/wultra/core/http/common/headers/UserAgent.java +++ b/http-common/src/main/java/com/wultra/core/http/common/headers/UserAgent.java @@ -31,6 +31,9 @@ @Slf4j public final class UserAgent { + /** + * Device information. + */ @Data public static class Device { private String networkVersion; diff --git a/rest-client-base/src/test/java/com/wultra/core/rest/client/base/config/WebSecurityConfig.java b/rest-client-base/src/test/java/com/wultra/core/rest/client/base/config/WebSecurityConfig.java index a558998..00f7bc4 100644 --- a/rest-client-base/src/test/java/com/wultra/core/rest/client/base/config/WebSecurityConfig.java +++ b/rest-client-base/src/test/java/com/wultra/core/rest/client/base/config/WebSecurityConfig.java @@ -18,6 +18,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.configurers.AbstractHttpConfigurer; import org.springframework.security.core.userdetails.User; import org.springframework.security.core.userdetails.UserDetailsService; import org.springframework.security.web.SecurityFilterChain; @@ -53,13 +54,16 @@ private DigestAuthenticationFilter digestAuthenticationFilter() { @Bean public SecurityFilterChain filterChain(HttpSecurity http) throws Exception { - return http.csrf().disable() + http + .csrf(AbstractHttpConfigurer::disable) .exceptionHandling(e -> e.authenticationEntryPoint(authenticationEntryPoint())) .addFilter(digestAuthenticationFilter()) - .authorizeHttpRequests() - .requestMatchers("/private/**").authenticated() - .anyRequest().permitAll() - .and().build(); + .authorizeHttpRequests(authorize -> authorize + .requestMatchers("/private/**").authenticated() + .anyRequest().permitAll() + ); + + return http.build(); } @Bean From bde0ccc144579a59fcf359ff2091cf89cbfef0c9 Mon Sep 17 00:00:00 2001 From: Roman Strobl Date: Wed, 14 Aug 2024 14:17:09 +0200 Subject: [PATCH 2/2] Improve code style --- .../core/rest/client/base/config/WebSecurityConfig.java | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/rest-client-base/src/test/java/com/wultra/core/rest/client/base/config/WebSecurityConfig.java b/rest-client-base/src/test/java/com/wultra/core/rest/client/base/config/WebSecurityConfig.java index 00f7bc4..e9655c6 100644 --- a/rest-client-base/src/test/java/com/wultra/core/rest/client/base/config/WebSecurityConfig.java +++ b/rest-client-base/src/test/java/com/wultra/core/rest/client/base/config/WebSecurityConfig.java @@ -54,16 +54,14 @@ private DigestAuthenticationFilter digestAuthenticationFilter() { @Bean public SecurityFilterChain filterChain(HttpSecurity http) throws Exception { - http + return http .csrf(AbstractHttpConfigurer::disable) .exceptionHandling(e -> e.authenticationEntryPoint(authenticationEntryPoint())) .addFilter(digestAuthenticationFilter()) .authorizeHttpRequests(authorize -> authorize .requestMatchers("/private/**").authenticated() .anyRequest().permitAll() - ); - - return http.build(); + ).build(); } @Bean