|
@@ -149,24 +149,12 @@ public class PostAuthorizeReactiveAuthorizationManagerTests {
|
|
assertThat(decision.isGranted()).isFalse();
|
|
assertThat(decision.isGranted()).isFalse();
|
|
}
|
|
}
|
|
|
|
|
|
- @Test
|
|
|
|
- public void checkInheritedAnnotationsWhenDuplicatedThenAnnotationConfigurationException() throws Exception {
|
|
|
|
- Mono<Authentication> authentication = Mono
|
|
|
|
- .just(new TestingAuthenticationToken("user", "password", "ROLE_USER"));
|
|
|
|
- MockMethodInvocation methodInvocation = new MockMethodInvocation(new TestClass(), TestClass.class,
|
|
|
|
- "inheritedAnnotations");
|
|
|
|
- MethodInvocationResult result = new MethodInvocationResult(methodInvocation, null);
|
|
|
|
- PostAuthorizeReactiveAuthorizationManager manager = new PostAuthorizeReactiveAuthorizationManager();
|
|
|
|
- assertThatExceptionOfType(AnnotationConfigurationException.class)
|
|
|
|
- .isThrownBy(() -> manager.check(authentication, result));
|
|
|
|
- }
|
|
|
|
-
|
|
|
|
@Test
|
|
@Test
|
|
public void checkInheritedAnnotationsWhenConflictingThenAnnotationConfigurationException() throws Exception {
|
|
public void checkInheritedAnnotationsWhenConflictingThenAnnotationConfigurationException() throws Exception {
|
|
Mono<Authentication> authentication = Mono
|
|
Mono<Authentication> authentication = Mono
|
|
.just(new TestingAuthenticationToken("user", "password", "ROLE_USER"));
|
|
.just(new TestingAuthenticationToken("user", "password", "ROLE_USER"));
|
|
- MockMethodInvocation methodInvocation = new MockMethodInvocation(new TestClass(), TestClass.class,
|
|
|
|
- "inheritedAnnotations");
|
|
|
|
|
|
+ MockMethodInvocation methodInvocation = new MockMethodInvocation(new ConflictingAnnotations(),
|
|
|
|
+ ConflictingAnnotations.class, "inheritedAnnotations");
|
|
MethodInvocationResult result = new MethodInvocationResult(methodInvocation, null);
|
|
MethodInvocationResult result = new MethodInvocationResult(methodInvocation, null);
|
|
PostAuthorizeReactiveAuthorizationManager manager = new PostAuthorizeReactiveAuthorizationManager();
|
|
PostAuthorizeReactiveAuthorizationManager manager = new PostAuthorizeReactiveAuthorizationManager();
|
|
assertThatExceptionOfType(AnnotationConfigurationException.class)
|
|
assertThatExceptionOfType(AnnotationConfigurationException.class)
|
|
@@ -216,6 +204,14 @@ public class PostAuthorizeReactiveAuthorizationManagerTests {
|
|
|
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
+ public static class ConflictingAnnotations implements InterfaceAnnotationsOne, InterfaceAnnotationsTwo {
|
|
|
|
+
|
|
|
|
+ @Override
|
|
|
|
+ public void inheritedAnnotations() {
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ }
|
|
|
|
+
|
|
public interface InterfaceAnnotationsOne {
|
|
public interface InterfaceAnnotationsOne {
|
|
|
|
|
|
@PostAuthorize("hasRole('ADMIN')")
|
|
@PostAuthorize("hasRole('ADMIN')")
|