Closed
Description
It would be nice if we supported throwing AccessDeniedException
for Method Security SpEL. This would allow method security to easily convey more information to the framework on why authorization failed (e.g. requires MFA). They can also use AuthorizationManager instances in their SpEL. For example:
@Service
class Authz {
AuthorizationDecision check(...) {
throw new AccessDeniedException("Denied");
}
}
@PreAuthorize("@authz.check(...)")