@ -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`.
@ -137,3 +137,71 @@ You will notice that since we are invoking the `hasRole` method we do not need t
@@ -137,3 +137,71 @@ You will notice that since we are invoking the `hasRole` method we do not need t
You will notice that since we are using the `hasRole` expression we do not need to specify the "ROLE_" prefix.
<5> Any URL that has not already been matched on is denied access.
This is a good strategy if you do not want to accidentally forget to update your authorization rules.
[[filtersecurityinterceptor-every-request]]
== Apply FilterSecurityInterceptor to every request
By default, the `FilterSecurityInterceptor` only applies once to a request.
This means that if a request is dispatched from a request that was already filtered, the `FilterSecurityInterceptor` will back-off and not perform any authorization checks.
In some scenarios, you may want to apply the filter to every request.
You can configure Spring Security to apply the authorization rules to every request by using the `filterSecurityInterceptorOncePerRequest` method:
.Set filterSecurityInterceptorOncePerRequest to false