-
Notifications
You must be signed in to change notification settings - Fork 6.2k
Open
Labels
status: waiting-for-triageAn issue we've not yet triagedAn issue we've not yet triagedtype: enhancementA general enhancementA general enhancement
Description
Expected Behavior
The following code should work:
@Bean
public SecurityFilterChain securityFilterChain(HttpSecurity http, ApplicationContext context)
throws Exception {
http.authorizeHttpRequests(
requests ->
requests
.requestMatchers("/admin/{id}")
.access(
new WebExpressionAuthorizationManager(
"hasRole('ADMIN') && @webSecurity.check(#id)")));
http.httpBasic();
return http.build();
}
Current Behavior
Currently, it throws an exception:
Caused by: org.springframework.expression.spel.SpelEvaluationException: EL1057E: No bean resolver registered in the context to resolve access to bean 'webSecurity'
The reason is that the application context is not set in the expressionHandler class WebExpressionAuthorizationManager.
The workarounds described by rwinch in #12974 are too complicated in a more complex security configuration.
This improvement would solve: #13184
s3curitybug
Metadata
Metadata
Assignees
Labels
status: waiting-for-triageAn issue we've not yet triagedAn issue we've not yet triagedtype: enhancementA general enhancementA general enhancement