-
Notifications
You must be signed in to change notification settings - Fork 6.2k
Closed
Labels
in: coreAn issue in spring-security-coreAn issue in spring-security-corestatus: declinedA suggestion or change that we don't feel we should currently applyA suggestion or change that we don't feel we should currently applytype: bugA general bugA general bug
Milestone
Description
A test like this:
public class HandleTests {
@Test
public void test() {
AuthorizationProxyFactory proxyFactory = AuthorizationAdvisorProxyFactory.withDefaults();
Account account = (Account) proxyFactory.proxy(new Account());
assertThat(account.getAccountNumber()).isNull();
}
public static class Account {
@PreAuthorize("denyAll")
@HandleAuthorizationDenied(handlerClass = NullMethodAuthorizationDeniedHandler.class)
public String getAccountNumber() {
return "123";
}
}
public class NullMethodAuthorizationDeniedHandler implements MethodAuthorizationDeniedHandler {
@Override
public Object handleDeniedInvocation(MethodInvocation methodInvocation, AuthorizationResult authorizationResult) {
return null;
}
}
}Will fall back to throwing an exception since there is no application context provided to PostAuthorizeAuthorizationManager.
Instead, it should at least error so the application doesn't get the impression that their handler class is being used.
Metadata
Metadata
Assignees
Labels
in: coreAn issue in spring-security-coreAn issue in spring-security-corestatus: declinedA suggestion or change that we don't feel we should currently applyA suggestion or change that we don't feel we should currently applytype: bugA general bugA general bug