Format authorizeExchange Blocks
This commit formats authorizeExchange blocks to use a common variable name and ensure the variable and reference are on the same line. Issue gh-13067
This commit is contained in:
@@ -24,7 +24,7 @@ SecurityWebFilterChain http(ServerHttpSecurity http) throws Exception {
|
||||
);
|
||||
|
||||
http
|
||||
.authorizeExchange((exchange) -> exchange.anyExchange().authenticated())
|
||||
.authorizeExchange((authorize) -> authorize.anyExchange().authenticated())
|
||||
.logout((logout) -> logout.logoutHandler(logoutHandler));
|
||||
|
||||
return http.build();
|
||||
@@ -40,7 +40,7 @@ fun http(http: ServerHttpSecurity): SecurityWebFilterChain {
|
||||
val customLogoutHandler = DelegatingServerLogoutHandler(
|
||||
SecurityContextServerLogoutHandler(), WebSessionServerLogoutHandler()
|
||||
)
|
||||
|
||||
|
||||
return http {
|
||||
authorizeExchange {
|
||||
authorize(anyExchange, authenticated)
|
||||
|
||||
@@ -15,7 +15,7 @@ Java::
|
||||
@Bean
|
||||
SecurityWebFilterChain springSecurityFilterChain(ServerHttpSecurity http) {
|
||||
http
|
||||
.authorizeExchange((exchanges) -> exchanges
|
||||
.authorizeExchange((authorize) -> authorize
|
||||
.anyExchange().authenticated()
|
||||
)
|
||||
.httpBasic(withDefaults())
|
||||
|
||||
@@ -614,7 +614,7 @@ public class SecurityConfig {
|
||||
return 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())
|
||||
|
||||
@@ -87,7 +87,7 @@ public class HelloWebfluxSecurityConfig {
|
||||
@Bean
|
||||
public SecurityWebFilterChain springSecurityFilterChain(ServerHttpSecurity http) {
|
||||
http
|
||||
.authorizeExchange((exchanges) -> exchanges
|
||||
.authorizeExchange((authorize) -> authorize
|
||||
.anyExchange().authenticated()
|
||||
)
|
||||
.httpBasic(withDefaults())
|
||||
@@ -161,7 +161,7 @@ static class MultiSecurityHttpConfig {
|
||||
SecurityWebFilterChain apiHttpSecurity(ServerHttpSecurity http) {
|
||||
http
|
||||
.securityMatcher(new PathPatternParserServerWebExchangeMatcher("/api/**")) <2>
|
||||
.authorizeExchange((exchanges) -> exchanges
|
||||
.authorizeExchange((authorize) -> authorize
|
||||
.anyExchange().authenticated()
|
||||
)
|
||||
.oauth2ResourceServer(OAuth2ResourceServerSpec::jwt); <3>
|
||||
@@ -171,7 +171,7 @@ static class MultiSecurityHttpConfig {
|
||||
@Bean
|
||||
SecurityWebFilterChain webHttpSecurity(ServerHttpSecurity http) { <4>
|
||||
http
|
||||
.authorizeExchange((exchanges) -> exchanges
|
||||
.authorizeExchange((authorize) -> authorize
|
||||
.anyExchange().authenticated()
|
||||
)
|
||||
.httpBasic(withDefaults()); <5>
|
||||
|
||||
@@ -128,7 +128,7 @@ Java::
|
||||
@Bean
|
||||
SecurityWebFilterChain springSecurityFilterChain(ServerHttpSecurity http) {
|
||||
http
|
||||
.authorizeExchange((exchanges) -> exchanges
|
||||
.authorizeExchange((authorize) -> authorize
|
||||
.anyExchange().authenticated()
|
||||
)
|
||||
.oauth2ResourceServer(OAuth2ResourceServerSpec::jwt)
|
||||
@@ -170,7 +170,7 @@ import static org.springframework.security.oauth2.core.authorization.OAuth2React
|
||||
@Bean
|
||||
SecurityWebFilterChain springSecurityFilterChain(ServerHttpSecurity http) {
|
||||
http
|
||||
.authorizeExchange((exchanges) -> exchanges
|
||||
.authorizeExchange((authorize) -> authorize
|
||||
.pathMatchers("/message/**").access(hasScope("message:read"))
|
||||
.anyExchange().authenticated()
|
||||
)
|
||||
@@ -254,7 +254,7 @@ Java::
|
||||
@Bean
|
||||
SecurityWebFilterChain springSecurityFilterChain(ServerHttpSecurity http) {
|
||||
http
|
||||
.authorizeExchange((exchanges) -> exchanges
|
||||
.authorizeExchange((authorize) -> authorize
|
||||
.anyExchange().authenticated()
|
||||
)
|
||||
.oauth2ResourceServer((oauth2) -> oauth2
|
||||
@@ -302,7 +302,7 @@ Java::
|
||||
@Bean
|
||||
SecurityWebFilterChain springSecurityFilterChain(ServerHttpSecurity http) {
|
||||
http
|
||||
.authorizeExchange((exchanges) -> exchanges
|
||||
.authorizeExchange((authorize) -> authorize
|
||||
.anyExchange().authenticated()
|
||||
)
|
||||
.oauth2ResourceServer((oauth2) -> oauth2
|
||||
@@ -691,7 +691,7 @@ import static org.springframework.security.oauth2.core.authorization.OAuth2React
|
||||
@Bean
|
||||
SecurityWebFilterChain springSecurityFilterChain(ServerHttpSecurity http) {
|
||||
http
|
||||
.authorizeExchange((exchanges) -> exchanges
|
||||
.authorizeExchange((authorize) -> authorize
|
||||
.mvcMatchers("/contacts/**").access(hasScope("contacts"))
|
||||
.mvcMatchers("/messages/**").access(hasScope("messages"))
|
||||
.anyExchange().authenticated()
|
||||
@@ -762,7 +762,7 @@ Java::
|
||||
@Bean
|
||||
SecurityWebFilterChain springSecurityFilterChain(ServerHttpSecurity http) {
|
||||
http
|
||||
.authorizeExchange((exchanges) -> exchanges
|
||||
.authorizeExchange((authorize) -> authorize
|
||||
.anyExchange().authenticated()
|
||||
)
|
||||
.oauth2ResourceServer((oauth2) -> oauth2
|
||||
|
||||
@@ -27,7 +27,7 @@ JwtIssuerReactiveAuthenticationManagerResolver authenticationManagerResolver = J
|
||||
.fromTrustedIssuers("https://idp.example.org/issuerOne", "https://idp.example.org/issuerTwo");
|
||||
|
||||
http
|
||||
.authorizeExchange((exchanges) -> exchanges
|
||||
.authorizeExchange((authorize) -> authorize
|
||||
.anyExchange().authenticated()
|
||||
)
|
||||
.oauth2ResourceServer((oauth2) -> oauth2
|
||||
@@ -83,7 +83,7 @@ JwtIssuerReactiveAuthenticationManagerResolver authenticationManagerResolver =
|
||||
new JwtIssuerReactiveAuthenticationManagerResolver(authenticationManagers::get);
|
||||
|
||||
http
|
||||
.authorizeExchange((exchanges) -> exchanges
|
||||
.authorizeExchange((authorize) -> authorize
|
||||
.anyExchange().authenticated()
|
||||
)
|
||||
.oauth2ResourceServer((oauth2) -> oauth2
|
||||
|
||||
@@ -176,7 +176,7 @@ Java::
|
||||
@Bean
|
||||
SecurityWebFilterChain springSecurityFilterChain(ServerHttpSecurity http) {
|
||||
http
|
||||
.authorizeExchange((exchanges) -> exchanges
|
||||
.authorizeExchange((authorize) -> authorize
|
||||
.anyExchange().authenticated()
|
||||
)
|
||||
.oauth2ResourceServer(ServerHttpSecurity.OAuth2ResourceServerSpec::opaqueToken)
|
||||
@@ -221,7 +221,7 @@ public class MyCustomSecurityConfiguration {
|
||||
@Bean
|
||||
SecurityWebFilterChain springSecurityFilterChain(ServerHttpSecurity http) {
|
||||
http
|
||||
.authorizeExchange((exchanges) -> exchanges
|
||||
.authorizeExchange((authorize) -> authorize
|
||||
.pathMatchers("/messages/**").access(hasScope("message:read"))
|
||||
.anyExchange().authenticated()
|
||||
)
|
||||
@@ -310,7 +310,7 @@ public class DirectlyConfiguredIntrospectionUri {
|
||||
@Bean
|
||||
SecurityWebFilterChain springSecurityFilterChain(ServerHttpSecurity http) {
|
||||
http
|
||||
.authorizeExchange((exchanges) -> exchanges
|
||||
.authorizeExchange((authorize) -> authorize
|
||||
.anyExchange().authenticated()
|
||||
)
|
||||
.oauth2ResourceServer((oauth2) -> oauth2
|
||||
@@ -364,7 +364,7 @@ public class DirectlyConfiguredIntrospector {
|
||||
@Bean
|
||||
SecurityWebFilterChain springSecurityFilterChain(ServerHttpSecurity http) {
|
||||
http
|
||||
.authorizeExchange((exchanges) -> exchanges
|
||||
.authorizeExchange((authorize) -> authorize
|
||||
.anyExchange().authenticated()
|
||||
)
|
||||
.oauth2ResourceServer((oauth2) -> oauth2
|
||||
@@ -457,7 +457,7 @@ public class MappedAuthorities {
|
||||
@Bean
|
||||
SecurityWebFilterChain springSecurityFilterChain(ServerHttpSecurity http) {
|
||||
http
|
||||
.authorizeExchange((exchange) -> exchange
|
||||
.authorizeExchange((authorize) -> authorize
|
||||
.pathMatchers("/contacts/**").access(hasScope("contacts"))
|
||||
.pathMatchers("/messages/**").access(hasScope("messages"))
|
||||
.anyExchange().authenticated()
|
||||
|
||||
Reference in New Issue
Block a user