You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: docs/manual/src/docs/asciidoc/_includes/reactive/webflux.adoc
+44-43Lines changed: 44 additions & 43 deletions
Original file line number
Diff line number
Diff line change
@@ -128,57 +128,58 @@ From here you can easily make the changes to the defaults.
128
128
You can find more examples of explicit configuration in unit tests, by searching https://github.com/spring-projects/spring-security/search?q=path%3Aconfig%2Fsrc%2Ftest%2F+EnableWebFluxSecurity[EnableWebFluxSecurity in the `config/src/test/` directory].
129
129
130
130
[[jc-webflux-multiple-filter-chains]]
131
-
=== Multiple chains support
131
+
=== Multiple Chains Support
132
132
133
-
We can configure multiple `SecurityWebFilterChain` instances.
133
+
You can configure multiple `SecurityWebFilterChain` instances to separate configuration by `RequestMatcher` s.
134
134
135
-
For example, the following is an example of having a specific configuration for URL's that start with `/api/`. This overrides the form login configuration with lower precedence.
135
+
For example, you can isolate configuration for URLs that start with `/api`, like so:
<1> Configure a SecurityWebFilterChain with an `@Order` to specify which `SecurityWebFilterChain` should be considered first
179
-
<2> The `PathPatternParserServerWebExchangeMatcher` states that this `SecurityWebFilterChain` will only be applicable to URLs that start with `/api/`
180
-
<3> Create another instance of `SecurityWebFilterChain` with lower precedence.
181
-
<4> Some configurations applies to all path matchers within the `webFormHttpSecurity` but not to `apiHttpSecurity` `SecurityWebFilterChain`.
174
+
<1> Configure a `SecurityWebFilterChain` with an `@Order` to specify which `SecurityWebFilterChain` Spring Security should consider first
175
+
<2> Use `PathPatternParserServerWebExchangeMatcher` to state that this `SecurityWebFilterChain` will only apply to URL paths that start with `/api/`
176
+
<3> Specify the authentication mechanisms that will be used for `/api/**` endpoints
177
+
<4> Create another instance of `SecurityWebFilterChain` with lower precedence to match all other URLs
178
+
<5> Specify the authentication mechanisms that will be used for the rest of the application
179
+
180
+
Spring Security will select one `SecurityWebFilterChain` `@Bean` for each request.
181
+
It will match the requests in order by the `securityMatcher` definition.
182
182
183
-
If the URL does not start with `/api/` the `webFormHttpSecurity` configuration will be used.
183
+
In this case, that means that if the URL path starts with `/api`, then Spring Security will use `apiHttpSecurity`.
184
+
If the URL does not start with `/api` then Spring Security will default to `webHttpSecurity`, which has an implied `securityMatcher` that matches any request.
0 commit comments