SAP / cloud-security-services-integration-library

Integration libraries and samples for authenticating users and clients bound to XSUAA authentication and authorization service or Identity authentication service.
Apache License 2.0
151 stars 135 forks source link

Set SecurityContextStrategy based on an EnvironmentPostProcessor #1536

Closed beckermarc closed 5 months ago

beckermarc commented 5 months ago

Alternative proposal to https://github.com/SAP/cloud-security-services-integration-library/pull/1526 More explicit, by leveraging an EnvironmentPostProcessor, which runs very early in the startup phase and doesn't require the dependency to Servlet stuff introduced in the other PR. However looses the ability to exclude this AutoConfiguration through annotations or by defining a custom SecurityContextStrategy bean. Disabling the behaviour is only possible through properties with this approach.

Addon: Fixes an issue with MockMvc, as in this scenario the servlet initialization is not happening and the code runs too late due to that.