-
Couldn't load subscription status.
- 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
MethodAuthorizationDeniedHandler is an interface with a single non-default method, therefore it can be implemented by a lambda. However, HandleAuthorizationDenied can only reference a handler by class, excluding lambdas.
I would like HandleAuthorizationDenied to have an additional parameter String handler() default "" so that this is possible:
@Configuration
@EnableMethodSecurity
class MyConfiguration {
@Bean
MethodAuthorizationDeniedHandler emptyListHandler() {
return (invocation, result) -> List.of();
}
}
class Account {
String name;
@PreAuthorize("hasRole('DETAILS')")
@HandleAuthorizationDenied(handler = "emptyListHandler")
List<String> details;
}Even better if the handler name could be interpolated from a property or a spel expression.
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