Merge branch '5.8.x' into 6.1.x

Closes gh-15062
This commit is contained in:
Marcus Hert Da Coregio 2024-05-13 11:22:09 -03:00
commit f5b9dc3282
1 changed files with 3 additions and 1 deletions

View File

@ -105,6 +105,7 @@ Java::
[source,java,role="primary"] [source,java,role="primary"]
---- ----
@Bean @Bean
@Role(BeanDefinition.ROLE_INFRASTRUCTURE)
static GrantedAuthorityDefaults grantedAuthorityDefaults() { static GrantedAuthorityDefaults grantedAuthorityDefaults() {
return new GrantedAuthorityDefaults("MYPREFIX_"); return new GrantedAuthorityDefaults("MYPREFIX_");
} }
@ -113,7 +114,8 @@ static GrantedAuthorityDefaults grantedAuthorityDefaults() {
[TIP] [TIP]
==== ====
We expose `GrantedAuthorityDefaults` using a `static` method to ensure that Spring publishes it before it initializes Spring Security's method security `@Configuration` classes We expose `GrantedAuthorityDefaults` using a `static` method to ensure that Spring publishes it before it initializes Spring Security's method security `@Configuration` classes.
Since the `GrantedAuthorityDefaults` bean is part of internal workings of Spring Security, we should also expose it as an infrastructural bean effectively avoiding some warnings related to bean post-processing (see https://github.com/spring-projects/spring-security/issues/14751[gh-14751]).
==== ====
[[jc-reactive-method-security-custom-authorization-manager]] [[jc-reactive-method-security-custom-authorization-manager]]