matrei opened a new pull request, #16791:
URL: https://github.com/apache/grails-core/pull/16791
## Description
The Spring Security plugin now registers a filter, `StartupGateFilter`, that
responds to every request with `503 Service Unavailable` until the application
has started. The filter lets requests through once both of these have happened,
in either order:
- The plugin's `doWithApplicationContext()` has run.
- Spring Boot has published `ApplicationStartedEvent`.
The filter is registered on `/*` for the `REQUEST` and `ERROR` dispatcher
types, at `Ordered.HIGHEST_PRECEDENCE + 1`. That leaves the highest precedence
to filters that answer requests themselves while the application starts. It
sets the status instead of calling `sendError()`, to avoid an error dispatch.
Set `grails.plugin.springsecurity.rejectRequestsDuringStartup` to `false` to
not register the filter. The property defaults to `true` in
`DefaultSecurityConfig` and is described in the plugin's configuration metadata.
### Tests
- `StartupGateFilterSpec` checks that the filter:
- responds with `503` and sets the status rather than sending an error;
- stays closed until both the plugin has initialized and the application
has started;
- opens in either order.
- `RejectRequestsDuringStartupDisabledSpec` loads the plugin with
`rejectRequestsDuringStartup = false`, and checks that neither the filter nor
its registration bean is registered.
These pass with the change:
- all tests of `grails-spring-security`;
- `integrationTest` of the Spring Security core integration test app;
- `codeStyle` for `grails-spring-security`.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]