AuthorizationManagerWebInvocationPrivilegeEvaluator grant access when AuthorizationManager abstains
Closes gh-10950
This commit is contained in:
parent
35ac1dd71e
commit
44508df940
|
@ -51,7 +51,7 @@ public final class AuthorizationManagerWebInvocationPrivilegeEvaluator implement
|
|||
FilterInvocation filterInvocation = new FilterInvocation(contextPath, uri, method);
|
||||
AuthorizationDecision decision = this.authorizationManager.check(() -> authentication,
|
||||
filterInvocation.getHttpRequest());
|
||||
return decision != null && decision.isGranted();
|
||||
return decision == null || decision.isGranted();
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -65,4 +65,11 @@ public class AuthorizationManagerWebInvocationPrivilegeEvaluatorTests {
|
|||
assertThat(allowed).isFalse();
|
||||
}
|
||||
|
||||
@Test
|
||||
public void isAllowedWhenAuthorizationManagerAbstainsThenAllowedTrue() {
|
||||
given(this.authorizationManager.check(any(), any())).willReturn(null);
|
||||
boolean allowed = this.privilegeEvaluator.isAllowed("/test", TestAuthentication.authenticatedUser());
|
||||
assertThat(allowed).isTrue();
|
||||
}
|
||||
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue