@ -205,3 +205,78 @@ open fun web(http: HttpSecurity): SecurityFilterChain {
@@ -205,3 +205,78 @@ open fun web(http: HttpSecurity): SecurityFilterChain {
}
----
====
Now with the authorization rules applying to all dispatcher types, you have more control of the authorization on them.
For example, you may want to configure `shouldFilterAllDispatcherTypes` to `true` but not apply authorization on requests with dispatcher type `ASYNC` or `FORWARD`.
@ -129,6 +129,7 @@ open fun filterChain(http: HttpSecurity): SecurityFilterChain {
@@ -129,6 +129,7 @@ open fun filterChain(http: HttpSecurity): SecurityFilterChain {
return http.build()
}
----
====
<1> There are multiple authorization rules specified.
Each rule is considered in the order they were declared.
<2> We specified multiple URL patterns that any user can access.
@ -141,3 +142,42 @@ You will notice that since we are using the `hasRole` expression we do not need
@@ -141,3 +142,42 @@ You will notice that since we are using the `hasRole` expression we do not need
This is a good strategy if you do not want to accidentally forget to update your authorization rules.
====
[[filtersecurityinterceptor-every-request]]
== Configure FilterSecurityInterceptor with Dispatcher Types
By default, the `FilterSecurityInterceptor` applies to every request.
This means that if a request is dispatched from a request that was already filtered, the `FilterSecurityInterceptor` will perform the same authorization checks on the dispatched request.
In some scenarios, you may not want to apply authorization on some dispatcher types: