Skip to content

Commit 44508df

Browse files
AuthorizationManagerWebInvocationPrivilegeEvaluator grant access when AuthorizationManager abstains
Closes gh-10950
1 parent 35ac1dd commit 44508df

File tree

2 files changed

+8
-1
lines changed

2 files changed

+8
-1
lines changed

web/src/main/java/org/springframework/security/web/access/AuthorizationManagerWebInvocationPrivilegeEvaluator.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,7 @@ public boolean isAllowed(String contextPath, String uri, String method, Authenti
5151
FilterInvocation filterInvocation = new FilterInvocation(contextPath, uri, method);
5252
AuthorizationDecision decision = this.authorizationManager.check(() -> authentication,
5353
filterInvocation.getHttpRequest());
54-
return decision != null && decision.isGranted();
54+
return decision == null || decision.isGranted();
5555
}
5656

5757
}

web/src/test/java/org/springframework/security/web/access/AuthorizationManagerWebInvocationPrivilegeEvaluatorTests.java

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -65,4 +65,11 @@ public void isAllowedWhenAuthorizationManagerDeniesAllowedFalse() {
6565
assertThat(allowed).isFalse();
6666
}
6767

68+
@Test
69+
public void isAllowedWhenAuthorizationManagerAbstainsThenAllowedTrue() {
70+
given(this.authorizationManager.check(any(), any())).willReturn(null);
71+
boolean allowed = this.privilegeEvaluator.isAllowed("/test", TestAuthentication.authenticatedUser());
72+
assertThat(allowed).isTrue();
73+
}
74+
6875
}

0 commit comments

Comments
 (0)