From 3a58daf55daa1d26dc1a67f95ee2cc46418f95e2 Mon Sep 17 00:00:00 2001 From: Josh Cummings Date: Wed, 10 Nov 2021 09:42:09 -0700 Subject: [PATCH] Update HttpSecurity Formatting --- .../WebfluxFormSecurityConfiguration.java | 2 +- .../java/example/WebfluxX509Application.java | 2 +- .../java/example/SecurityConfiguration.java | 2 +- .../java/example/SecurityConfiguration.java | 2 +- .../java/example/SecurityConfiguration.java | 2 +- .../java/example/SecurityConfiguration.java | 2 +- .../java/example/SecurityConfiguration.java | 14 +++----- .../java/example/SecurityConfiguration.java | 4 +-- .../java/example/SecurityConfiguration.java | 2 +- .../java/example/SecurityConfiguration.java | 5 ++- .../java/example/SecurityConfiguration.java | 10 +++--- .../java/example/SecurityConfiguration.java | 10 +++--- .../java/example/SecurityConfiguration.java | 2 +- .../src/main/java/example/SecurityConfig.java | 33 +++++++++++-------- .../java/example/SecurityConfiguration.java | 2 +- .../src/main/java/example/RestConfig.java | 5 ++- ...horizationServerSecurityConfiguration.java | 4 ++- .../example/OAuth2LoginApplicationTests.java | 10 ++---- ...h2ResourceServerSecurityConfiguration.java | 9 +++-- ...h2ResourceServerSecurityConfiguration.java | 12 +++---- ...h2ResourceServerSecurityConfiguration.java | 4 +-- ...h2ResourceServerSecurityConfiguration.java | 18 +++++----- ...h2ResourceServerSecurityConfiguration.java | 12 +++---- .../java/example/SecurityConfiguration.java | 6 ++-- .../java/example/SecurityConfiguration.java | 10 +++--- .../java/example/SecurityConfiguration.java | 10 +++--- .../java/example/SecurityConfiguration.java | 4 ++- 27 files changed, 98 insertions(+), 100 deletions(-) diff --git a/reactive/webflux/java/authentication/username-password/form/src/main/java/example/WebfluxFormSecurityConfiguration.java b/reactive/webflux/java/authentication/username-password/form/src/main/java/example/WebfluxFormSecurityConfiguration.java index 2c3a781..639a2de 100644 --- a/reactive/webflux/java/authentication/username-password/form/src/main/java/example/WebfluxFormSecurityConfiguration.java +++ b/reactive/webflux/java/authentication/username-password/form/src/main/java/example/WebfluxFormSecurityConfiguration.java @@ -53,7 +53,7 @@ public class WebfluxFormSecurityConfiguration { SecurityWebFilterChain springSecurityFilterChain(ServerHttpSecurity http) { // @formatter:off http - .authorizeExchange((exchanges) -> exchanges + .authorizeExchange((authorize) -> authorize .pathMatchers("/login").permitAll() .anyExchange().authenticated() ) diff --git a/reactive/webflux/java/authentication/x509/src/main/java/example/WebfluxX509Application.java b/reactive/webflux/java/authentication/x509/src/main/java/example/WebfluxX509Application.java index dced89b..2c73b07 100644 --- a/reactive/webflux/java/authentication/x509/src/main/java/example/WebfluxX509Application.java +++ b/reactive/webflux/java/authentication/x509/src/main/java/example/WebfluxX509Application.java @@ -53,7 +53,7 @@ public class WebfluxX509Application { // @formatter:off http .x509(withDefaults()) - .authorizeExchange((exchanges) -> exchanges + .authorizeExchange((authorize) -> authorize .anyExchange().authenticated() ); // @formatter:on diff --git a/reactive/webflux/java/hello-security-explicit/src/main/java/example/SecurityConfiguration.java b/reactive/webflux/java/hello-security-explicit/src/main/java/example/SecurityConfiguration.java index b8ca5a7..b834cd5 100644 --- a/reactive/webflux/java/hello-security-explicit/src/main/java/example/SecurityConfiguration.java +++ b/reactive/webflux/java/hello-security-explicit/src/main/java/example/SecurityConfiguration.java @@ -39,7 +39,7 @@ public class SecurityConfiguration { SecurityWebFilterChain springWebFilterChain(ServerHttpSecurity http) { // @formatter:off http - .authorizeExchange((exchanges) -> exchanges + .authorizeExchange((authorize) -> authorize .anyExchange().authenticated() ) .formLogin(withDefaults()); diff --git a/reactive/webflux/java/method/src/main/java/example/SecurityConfiguration.java b/reactive/webflux/java/method/src/main/java/example/SecurityConfiguration.java index 2ba25af..3d40a91 100644 --- a/reactive/webflux/java/method/src/main/java/example/SecurityConfiguration.java +++ b/reactive/webflux/java/method/src/main/java/example/SecurityConfiguration.java @@ -45,7 +45,7 @@ public class SecurityConfiguration { http // Demonstrate that method security works // Best practice to use both for defense in depth - .authorizeExchange((exchanges) -> exchanges + .authorizeExchange((authorize) -> authorize .anyExchange().permitAll() ) .httpBasic(withDefaults()); diff --git a/reactive/webflux/java/oauth2/resource-server/src/main/java/example/SecurityConfiguration.java b/reactive/webflux/java/oauth2/resource-server/src/main/java/example/SecurityConfiguration.java index 6acf6aa..97e3508 100644 --- a/reactive/webflux/java/oauth2/resource-server/src/main/java/example/SecurityConfiguration.java +++ b/reactive/webflux/java/oauth2/resource-server/src/main/java/example/SecurityConfiguration.java @@ -37,7 +37,7 @@ public class SecurityConfiguration { SecurityWebFilterChain springSecurityFilterChain(ServerHttpSecurity http) { // @formatter:off http - .authorizeExchange((exchanges) -> exchanges + .authorizeExchange((authorize) -> authorize .pathMatchers(HttpMethod.GET, "/message/**").hasAuthority("SCOPE_message:read") .pathMatchers(HttpMethod.POST, "/message/**").hasAuthority("SCOPE_message:write") .anyExchange().authenticated() diff --git a/reactive/webflux/java/oauth2/webclient/src/main/java/example/SecurityConfiguration.java b/reactive/webflux/java/oauth2/webclient/src/main/java/example/SecurityConfiguration.java index a148499..1e48b31 100644 --- a/reactive/webflux/java/oauth2/webclient/src/main/java/example/SecurityConfiguration.java +++ b/reactive/webflux/java/oauth2/webclient/src/main/java/example/SecurityConfiguration.java @@ -37,7 +37,7 @@ public class SecurityConfiguration { SecurityWebFilterChain configure(ServerHttpSecurity http) { // @formatter:off http - .authorizeExchange((exchanges) -> exchanges + .authorizeExchange((authorize) -> authorize .pathMatchers("/", "/public/**").permitAll() .anyExchange().authenticated() ) diff --git a/servlet/java-configuration/authentication/preauth/src/main/java/example/SecurityConfiguration.java b/servlet/java-configuration/authentication/preauth/src/main/java/example/SecurityConfiguration.java index 121ba79..0657feb 100644 --- a/servlet/java-configuration/authentication/preauth/src/main/java/example/SecurityConfiguration.java +++ b/servlet/java-configuration/authentication/preauth/src/main/java/example/SecurityConfiguration.java @@ -31,15 +31,11 @@ public class SecurityConfiguration extends WebSecurityConfigurerAdapter { @Override protected void configure(HttpSecurity http) throws Exception { http - .authorizeRequests((authorizeRequests) -> - authorizeRequests - .antMatchers("/login", "/resources/**").permitAll() - .anyRequest().authenticated() - ) - .jee((jee) -> - jee - .mappableRoles("USER", "ADMIN") - ); + .authorizeRequests((authorize) -> authorize + .antMatchers("/login", "/resources/**").permitAll() + .anyRequest().authenticated() + ) + .jee((jee) -> jee.mappableRoles("USER", "ADMIN")); } // @formatter:on diff --git a/servlet/java-configuration/authentication/remember-me/src/main/java/example/SecurityConfiguration.java b/servlet/java-configuration/authentication/remember-me/src/main/java/example/SecurityConfiguration.java index 146f54b..9fcee8f 100644 --- a/servlet/java-configuration/authentication/remember-me/src/main/java/example/SecurityConfiguration.java +++ b/servlet/java-configuration/authentication/remember-me/src/main/java/example/SecurityConfiguration.java @@ -33,8 +33,8 @@ public class SecurityConfiguration extends WebSecurityConfigurerAdapter { // @formatter:off protected void configure(HttpSecurity http) throws Exception { http - .authorizeRequests((requests) -> requests - .anyRequest().authenticated() + .authorizeRequests((authorize) -> authorize + .anyRequest().authenticated() ) .formLogin((form) -> form .loginPage("/login") diff --git a/servlet/java-configuration/authentication/username-password/form/src/main/java/example/SecurityConfiguration.java b/servlet/java-configuration/authentication/username-password/form/src/main/java/example/SecurityConfiguration.java index d7e59a9..1a99d4d 100644 --- a/servlet/java-configuration/authentication/username-password/form/src/main/java/example/SecurityConfiguration.java +++ b/servlet/java-configuration/authentication/username-password/form/src/main/java/example/SecurityConfiguration.java @@ -31,7 +31,7 @@ public class SecurityConfiguration extends WebSecurityConfigurerAdapter { // @formatter:off protected void configure(HttpSecurity http) throws Exception { http - .authorizeRequests((requests) -> requests + .authorizeRequests((authorize) -> authorize .anyRequest().authenticated() ) .formLogin((form) -> form diff --git a/servlet/java-configuration/authentication/x509/src/main/java/example/SecurityConfiguration.java b/servlet/java-configuration/authentication/x509/src/main/java/example/SecurityConfiguration.java index 2006a22..30e993e 100644 --- a/servlet/java-configuration/authentication/x509/src/main/java/example/SecurityConfiguration.java +++ b/servlet/java-configuration/authentication/x509/src/main/java/example/SecurityConfiguration.java @@ -33,9 +33,8 @@ public class SecurityConfiguration extends WebSecurityConfigurerAdapter { // @formatter:off protected void configure(HttpSecurity http) throws Exception { http - .authorizeRequests((authorizeRequests) -> - authorizeRequests - .anyRequest().authenticated() + .authorizeRequests((authorize) -> authorize + .anyRequest().authenticated() ) .x509(withDefaults()); } diff --git a/servlet/java-configuration/hello-mvc-security/src/main/java/example/SecurityConfiguration.java b/servlet/java-configuration/hello-mvc-security/src/main/java/example/SecurityConfiguration.java index 3574640..e96b4c5 100644 --- a/servlet/java-configuration/hello-mvc-security/src/main/java/example/SecurityConfiguration.java +++ b/servlet/java-configuration/hello-mvc-security/src/main/java/example/SecurityConfiguration.java @@ -33,11 +33,11 @@ public class SecurityConfiguration extends WebSecurityConfigurerAdapter { // @formatter:off protected void configure(HttpSecurity http) throws Exception { http - .authorizeRequests((requests) -> requests - .anyRequest().authenticated() - ) - .httpBasic(withDefaults()) - .formLogin(withDefaults()); + .authorizeRequests((authorize) -> authorize + .anyRequest().authenticated() + ) + .httpBasic(withDefaults()) + .formLogin(withDefaults()); } // @formatter:on diff --git a/servlet/java-configuration/hello-security-explicit/src/main/java/example/SecurityConfiguration.java b/servlet/java-configuration/hello-security-explicit/src/main/java/example/SecurityConfiguration.java index 3574640..e96b4c5 100644 --- a/servlet/java-configuration/hello-security-explicit/src/main/java/example/SecurityConfiguration.java +++ b/servlet/java-configuration/hello-security-explicit/src/main/java/example/SecurityConfiguration.java @@ -33,11 +33,11 @@ public class SecurityConfiguration extends WebSecurityConfigurerAdapter { // @formatter:off protected void configure(HttpSecurity http) throws Exception { http - .authorizeRequests((requests) -> requests - .anyRequest().authenticated() - ) - .httpBasic(withDefaults()) - .formLogin(withDefaults()); + .authorizeRequests((authorize) -> authorize + .anyRequest().authenticated() + ) + .httpBasic(withDefaults()) + .formLogin(withDefaults()); } // @formatter:on diff --git a/servlet/java-configuration/max-sessions/src/main/java/example/SecurityConfiguration.java b/servlet/java-configuration/max-sessions/src/main/java/example/SecurityConfiguration.java index 74d5983..3e54c4e 100644 --- a/servlet/java-configuration/max-sessions/src/main/java/example/SecurityConfiguration.java +++ b/servlet/java-configuration/max-sessions/src/main/java/example/SecurityConfiguration.java @@ -48,7 +48,7 @@ public class SecurityConfiguration extends WebSecurityConfigurerAdapter { @Override protected void configure(HttpSecurity http) throws Exception { http - .authorizeRequests((requests) -> requests + .authorizeRequests((authorize) -> authorize .anyRequest().authenticated() ) .formLogin(withDefaults()) diff --git a/servlet/spring-boot/java/authentication/username-password/mfa/src/main/java/example/SecurityConfig.java b/servlet/spring-boot/java/authentication/username-password/mfa/src/main/java/example/SecurityConfig.java index a6ea677..072c420 100644 --- a/servlet/spring-boot/java/authentication/username-password/mfa/src/main/java/example/SecurityConfig.java +++ b/servlet/spring-boot/java/authentication/username-password/mfa/src/main/java/example/SecurityConfig.java @@ -44,19 +44,26 @@ public class SecurityConfig { SecurityFilterChain web(HttpSecurity http, AuthorizationManager mfaAuthorizationManager) throws Exception { MfaAuthenticationHandler mfaAuthenticationHandler = new MfaAuthenticationHandler("/second-factor"); - http.authorizeHttpRequests((authz) -> authz.mvcMatchers("/second-factor", "/third-factor") - .access(mfaAuthorizationManager).anyRequest().authenticated()) - .formLogin((form) -> form.successHandler(mfaAuthenticationHandler) - .failureHandler(mfaAuthenticationHandler)) - .exceptionHandling((exceptions) -> exceptions - .withObjectPostProcessor(new ObjectPostProcessor() { - @Override - public O postProcess(O filter) { - filter.setAuthenticationTrustResolver(new MfaTrustResolver()); - return filter; - } - })); - + // @formatter:off + http + .authorizeHttpRequests((authorize) -> authorize + .mvcMatchers("/second-factor", "/third-factor").access(mfaAuthorizationManager) + .anyRequest().authenticated() + ) + .formLogin((form) -> form + .successHandler(mfaAuthenticationHandler) + .failureHandler(mfaAuthenticationHandler) + ) + .exceptionHandling((exceptions) -> exceptions + .withObjectPostProcessor(new ObjectPostProcessor() { + @Override + public O postProcess(O filter) { + filter.setAuthenticationTrustResolver(new MfaTrustResolver()); + return filter; + } + }) + ); + // @formatter:on return http.build(); } diff --git a/servlet/spring-boot/java/hello-security-explicit/src/main/java/example/SecurityConfiguration.java b/servlet/spring-boot/java/hello-security-explicit/src/main/java/example/SecurityConfiguration.java index ca56a80..72515e8 100644 --- a/servlet/spring-boot/java/hello-security-explicit/src/main/java/example/SecurityConfiguration.java +++ b/servlet/spring-boot/java/hello-security-explicit/src/main/java/example/SecurityConfiguration.java @@ -40,7 +40,7 @@ public class SecurityConfiguration extends WebSecurityConfigurerAdapter { // @formatter:off protected void configure(HttpSecurity http) throws Exception { http - .authorizeRequests((requests) -> requests + .authorizeRequests((authorize) -> authorize .anyRequest().authenticated() ) .httpBasic(withDefaults()) diff --git a/servlet/spring-boot/java/jwt/login/src/main/java/example/RestConfig.java b/servlet/spring-boot/java/jwt/login/src/main/java/example/RestConfig.java index 3ddb33f..cd5b74a 100644 --- a/servlet/spring-boot/java/jwt/login/src/main/java/example/RestConfig.java +++ b/servlet/spring-boot/java/jwt/login/src/main/java/example/RestConfig.java @@ -61,7 +61,10 @@ public class RestConfig extends WebSecurityConfigurerAdapter { @Override protected void configure(HttpSecurity http) throws Exception { // @formatter:off - http.authorizeRequests((authz) -> authz.anyRequest().authenticated()) + http + .authorizeRequests((authorize) -> authorize + .anyRequest().authenticated() + ) .csrf((csrf) -> csrf.ignoringAntMatchers("/token")) .httpBasic(Customizer.withDefaults()) .oauth2ResourceServer(OAuth2ResourceServerConfigurer::jwt) diff --git a/servlet/spring-boot/java/oauth2/authorization-server/src/main/java/example/OAuth2AuthorizationServerSecurityConfiguration.java b/servlet/spring-boot/java/oauth2/authorization-server/src/main/java/example/OAuth2AuthorizationServerSecurityConfiguration.java index aa54351..82685eb 100644 --- a/servlet/spring-boot/java/oauth2/authorization-server/src/main/java/example/OAuth2AuthorizationServerSecurityConfiguration.java +++ b/servlet/spring-boot/java/oauth2/authorization-server/src/main/java/example/OAuth2AuthorizationServerSecurityConfiguration.java @@ -72,7 +72,9 @@ public class OAuth2AuthorizationServerSecurityConfiguration { public SecurityFilterChain standardSecurityFilterChain(HttpSecurity http) throws Exception { // @formatter:off http - .authorizeRequests((requests) -> requests.anyRequest().authenticated()) + .authorizeRequests((authorize) -> authorize + .anyRequest().authenticated() + ) .formLogin(Customizer.withDefaults()); // @formatter:on diff --git a/servlet/spring-boot/java/oauth2/login/src/integTest/java/example/OAuth2LoginApplicationTests.java b/servlet/spring-boot/java/oauth2/login/src/integTest/java/example/OAuth2LoginApplicationTests.java index ddc60c8..ace74c3 100644 --- a/servlet/spring-boot/java/oauth2/login/src/integTest/java/example/OAuth2LoginApplicationTests.java +++ b/servlet/spring-boot/java/oauth2/login/src/integTest/java/example/OAuth2LoginApplicationTests.java @@ -334,16 +334,12 @@ public class OAuth2LoginApplicationTests { @Override protected void configure(HttpSecurity http) throws Exception { http - .authorizeRequests((requests) -> requests + .authorizeRequests((authorize) -> authorize .anyRequest().authenticated() ) .oauth2Login((oauth2) -> oauth2 - .tokenEndpoint((tokens) -> tokens - .accessTokenResponseClient(this.mockAccessTokenResponseClient()) - ) - .userInfoEndpoint((userInfo) -> userInfo - .userService(this.mockUserService()) - ) + .tokenEndpoint((token) -> token.accessTokenResponseClient(mockAccessTokenResponseClient())) + .userInfoEndpoint((userInfo) -> userInfo.userService(mockUserService())) ); } // @formatter:on diff --git a/servlet/spring-boot/java/oauth2/resource-server/hello-security/src/main/java/example/OAuth2ResourceServerSecurityConfiguration.java b/servlet/spring-boot/java/oauth2/resource-server/hello-security/src/main/java/example/OAuth2ResourceServerSecurityConfiguration.java index 29f187c..b90d479 100644 --- a/servlet/spring-boot/java/oauth2/resource-server/hello-security/src/main/java/example/OAuth2ResourceServerSecurityConfiguration.java +++ b/servlet/spring-boot/java/oauth2/resource-server/hello-security/src/main/java/example/OAuth2ResourceServerSecurityConfiguration.java @@ -40,11 +40,10 @@ public class OAuth2ResourceServerSecurityConfiguration extends WebSecurityConfig protected void configure(HttpSecurity http) throws Exception { // @formatter:off http - .authorizeRequests((requests) -> - requests - .antMatchers(HttpMethod.GET, "/message/**").hasAuthority("SCOPE_message:read") - .antMatchers(HttpMethod.POST, "/message/**").hasAuthority("SCOPE_message:write") - .anyRequest().authenticated() + .authorizeRequests((authorize) -> authorize + .antMatchers(HttpMethod.GET, "/message/**").hasAuthority("SCOPE_message:read") + .antMatchers(HttpMethod.POST, "/message/**").hasAuthority("SCOPE_message:write") + .anyRequest().authenticated() ) .oauth2ResourceServer(OAuth2ResourceServerConfigurer::jwt); // @formatter:on diff --git a/servlet/spring-boot/java/oauth2/resource-server/jwe/src/main/java/example/OAuth2ResourceServerSecurityConfiguration.java b/servlet/spring-boot/java/oauth2/resource-server/jwe/src/main/java/example/OAuth2ResourceServerSecurityConfiguration.java index 080e40f..dc5d624 100644 --- a/servlet/spring-boot/java/oauth2/resource-server/jwe/src/main/java/example/OAuth2ResourceServerSecurityConfiguration.java +++ b/servlet/spring-boot/java/oauth2/resource-server/jwe/src/main/java/example/OAuth2ResourceServerSecurityConfiguration.java @@ -72,15 +72,11 @@ public class OAuth2ResourceServerSecurityConfiguration extends WebSecurityConfig protected void configure(HttpSecurity http) throws Exception { // @formatter:off http - .authorizeRequests((requests) -> - requests - .antMatchers("/message/**").hasAuthority("SCOPE_message:read") - .anyRequest().authenticated() + .authorizeRequests((authorize) -> authorize + .antMatchers("/message/**").hasAuthority("SCOPE_message:read") + .anyRequest().authenticated() ) - .oauth2ResourceServer((resourceServer) -> - resourceServer - .jwt(withDefaults()) - ); + .oauth2ResourceServer((oauth2) -> oauth2.jwt(withDefaults())); // @formatter:on } diff --git a/servlet/spring-boot/java/oauth2/resource-server/multi-tenancy/src/main/java/example/OAuth2ResourceServerSecurityConfiguration.java b/servlet/spring-boot/java/oauth2/resource-server/multi-tenancy/src/main/java/example/OAuth2ResourceServerSecurityConfiguration.java index d67abe2..a0c9b12 100644 --- a/servlet/spring-boot/java/oauth2/resource-server/multi-tenancy/src/main/java/example/OAuth2ResourceServerSecurityConfiguration.java +++ b/servlet/spring-boot/java/oauth2/resource-server/multi-tenancy/src/main/java/example/OAuth2ResourceServerSecurityConfiguration.java @@ -47,11 +47,11 @@ public class OAuth2ResourceServerSecurityConfiguration { AuthenticationManagerResolver authenticationManagerResolver) throws Exception { // @formatter:off http - .authorizeRequests((requests) -> requests + .authorizeRequests((authorize) -> authorize .mvcMatchers("/**/message/**").hasAuthority("SCOPE_message:read") .anyRequest().authenticated() ) - .oauth2ResourceServer((resourceServer) -> resourceServer + .oauth2ResourceServer((oauth2) -> oauth2 .authenticationManagerResolver(authenticationManagerResolver) ); // @formatter:on diff --git a/servlet/spring-boot/java/oauth2/resource-server/opaque/src/main/java/example/OAuth2ResourceServerSecurityConfiguration.java b/servlet/spring-boot/java/oauth2/resource-server/opaque/src/main/java/example/OAuth2ResourceServerSecurityConfiguration.java index a3cfc65..8d498f0 100644 --- a/servlet/spring-boot/java/oauth2/resource-server/opaque/src/main/java/example/OAuth2ResourceServerSecurityConfiguration.java +++ b/servlet/spring-boot/java/oauth2/resource-server/opaque/src/main/java/example/OAuth2ResourceServerSecurityConfiguration.java @@ -42,16 +42,16 @@ public class OAuth2ResourceServerSecurityConfiguration extends WebSecurityConfig protected void configure(HttpSecurity http) throws Exception { // @formatter:off http - .authorizeRequests((requests) -> requests - .mvcMatchers(HttpMethod.GET, "/message/**").hasAuthority("SCOPE_message:read") - .mvcMatchers(HttpMethod.POST, "/message/**").hasAuthority("SCOPE_message:write") - .anyRequest().authenticated() + .authorizeRequests((authorize) -> authorize + .mvcMatchers(HttpMethod.GET, "/message/**").hasAuthority("SCOPE_message:read") + .mvcMatchers(HttpMethod.POST, "/message/**").hasAuthority("SCOPE_message:write") + .anyRequest().authenticated() ) - .oauth2ResourceServer((resourceServer) -> resourceServer - .opaqueToken((opaqueToken) -> opaqueToken - .introspectionUri(this.introspectionUri) - .introspectionClientCredentials(this.clientId, this.clientSecret) - ) + .oauth2ResourceServer((oauth2) -> oauth2 + .opaqueToken((opaque) -> opaque + .introspectionUri(this.introspectionUri) + .introspectionClientCredentials(this.clientId, this.clientSecret) + ) ); // @formatter:on } diff --git a/servlet/spring-boot/java/oauth2/resource-server/static/src/main/java/example/OAuth2ResourceServerSecurityConfiguration.java b/servlet/spring-boot/java/oauth2/resource-server/static/src/main/java/example/OAuth2ResourceServerSecurityConfiguration.java index 1992a9f..bb7074d 100644 --- a/servlet/spring-boot/java/oauth2/resource-server/static/src/main/java/example/OAuth2ResourceServerSecurityConfiguration.java +++ b/servlet/spring-boot/java/oauth2/resource-server/static/src/main/java/example/OAuth2ResourceServerSecurityConfiguration.java @@ -40,14 +40,12 @@ public class OAuth2ResourceServerSecurityConfiguration extends WebSecurityConfig protected void configure(HttpSecurity http) throws Exception { // @formatter:off http - .authorizeRequests((requests) -> requests - .mvcMatchers("/message/**").hasAuthority("SCOPE_message:read") - .anyRequest().authenticated() + .authorizeRequests((authorize) -> authorize + .mvcMatchers("/message/**").hasAuthority("SCOPE_message:read") + .anyRequest().authenticated() ) - .oauth2ResourceServer((resourceServer) -> resourceServer - .jwt((jwt) -> jwt - .decoder(jwtDecoder()) - ) + .oauth2ResourceServer((oauth2) -> oauth2 + .jwt((jwt) -> jwt.decoder(jwtDecoder())) ); // @formatter:on } diff --git a/servlet/spring-boot/java/oauth2/webclient/src/main/java/example/SecurityConfiguration.java b/servlet/spring-boot/java/oauth2/webclient/src/main/java/example/SecurityConfiguration.java index 87486af..c029fa3 100644 --- a/servlet/spring-boot/java/oauth2/webclient/src/main/java/example/SecurityConfiguration.java +++ b/servlet/spring-boot/java/oauth2/webclient/src/main/java/example/SecurityConfiguration.java @@ -38,9 +38,9 @@ public class SecurityConfiguration extends WebSecurityConfigurerAdapter { protected void configure(HttpSecurity http) throws Exception { // @formatter:off http - .authorizeRequests((requests) -> requests - .mvcMatchers("/", "/public/**").permitAll() - .anyRequest().authenticated() + .authorizeRequests((authorize) -> authorize + .mvcMatchers("/", "/public/**").permitAll() + .anyRequest().authenticated() ) .formLogin(withDefaults()) .oauth2Login(withDefaults()) diff --git a/servlet/spring-boot/java/saml2/login-single-tenant/src/main/java/example/SecurityConfiguration.java b/servlet/spring-boot/java/saml2/login-single-tenant/src/main/java/example/SecurityConfiguration.java index 75cbd28..e93a39e 100644 --- a/servlet/spring-boot/java/saml2/login-single-tenant/src/main/java/example/SecurityConfiguration.java +++ b/servlet/spring-boot/java/saml2/login-single-tenant/src/main/java/example/SecurityConfiguration.java @@ -36,11 +36,11 @@ public class SecurityConfiguration { SecurityFilterChain app(HttpSecurity http) throws Exception { // @formatter:off http - .authorizeRequests((authorize) -> authorize - .anyRequest().authenticated() - ) - .saml2Login((saml2) -> saml2.loginProcessingUrl("/login/saml2/sso")) - .saml2Logout(Customizer.withDefaults()); + .authorizeRequests((authorize) -> authorize + .anyRequest().authenticated() + ) + .saml2Login((saml2) -> saml2.loginProcessingUrl("/login/saml2/sso")) + .saml2Logout(Customizer.withDefaults()); // @formatter:on return http.build(); diff --git a/servlet/spring-boot/java/saml2/login/src/main/java/example/SecurityConfiguration.java b/servlet/spring-boot/java/saml2/login/src/main/java/example/SecurityConfiguration.java index 52f3391..d69fb7d 100644 --- a/servlet/spring-boot/java/saml2/login/src/main/java/example/SecurityConfiguration.java +++ b/servlet/spring-boot/java/saml2/login/src/main/java/example/SecurityConfiguration.java @@ -35,11 +35,11 @@ public class SecurityConfiguration { SecurityFilterChain app(HttpSecurity http) throws Exception { // @formatter:off http - .authorizeRequests((authorize) -> authorize - .anyRequest().authenticated() - ) - .saml2Login(Customizer.withDefaults()) - .saml2Logout(Customizer.withDefaults()); + .authorizeRequests((authorize) -> authorize + .anyRequest().authenticated() + ) + .saml2Login(Customizer.withDefaults()) + .saml2Logout(Customizer.withDefaults()); // @formatter:on return http.build(); diff --git a/servlet/spring-boot/java/saml2/refreshable-metadata/src/main/java/example/SecurityConfiguration.java b/servlet/spring-boot/java/saml2/refreshable-metadata/src/main/java/example/SecurityConfiguration.java index daff418..dc3a840 100644 --- a/servlet/spring-boot/java/saml2/refreshable-metadata/src/main/java/example/SecurityConfiguration.java +++ b/servlet/spring-boot/java/saml2/refreshable-metadata/src/main/java/example/SecurityConfiguration.java @@ -30,7 +30,9 @@ public class SecurityConfiguration { SecurityFilterChain app(HttpSecurity http) throws Exception { // @formatter:off http - .authorizeRequests((authorize) -> authorize.anyRequest().authenticated()) + .authorizeRequests((authorize) -> authorize + .anyRequest().authenticated() + ) .saml2Login(withDefaults()) .saml2Logout(withDefaults()); // @formatter:on