-
Notifications
You must be signed in to change notification settings - Fork 6.1k
Open
Labels
in: coreAn issue in spring-security-coreAn issue in spring-security-coretype: enhancementA general enhancementA general enhancement
Description
We should consider supporting expressions in method authorization handlers for simple setups. Currently, if you want to handle authorization denied and map the return value to null
, you must create a MethodAuthorizationDeniedHandler/PostProcessor
class and expose it as a bean:
@HandleAuthorizationDenied(handlerClass = Null.class)
public String getUserEmail() {
// ...
}
@Component
public class Null implements MethodAuthorizationDeniedHandler {
@Override
public Object handle(MethodInvocation methodInvocation, AuthorizationResult result) {
return null;
}
}
That is a little bit too complicated to just return null. A simpler setup could be:
@HandleAuthorizationDenied(handlerExpression = "null")
public String getUserEmail() {
// ...
}
@HandleAuthorizationDenied(handlerExpression = "***")
public String getUserEmail() {
// ...
}
Related:
Metadata
Metadata
Assignees
Labels
in: coreAn issue in spring-security-coreAn issue in spring-security-coretype: enhancementA general enhancementA general enhancement