mirror of
https://github.com/spring-projects/spring-security.git
synced 2025-07-09 11:53:30 +00:00
Correct Tests About Conflicting Annotations
Issue gh-9289
This commit is contained in:
parent
ffd4a0ff57
commit
56c93afc66
@ -159,8 +159,8 @@ public class PostAuthorizeAuthorizationManagerTests {
|
|||||||
@Test
|
@Test
|
||||||
public void checkInheritedAnnotationsWhenConflictingThenAnnotationConfigurationException() throws Exception {
|
public void checkInheritedAnnotationsWhenConflictingThenAnnotationConfigurationException() throws Exception {
|
||||||
Supplier<Authentication> authentication = () -> new TestingAuthenticationToken("user", "password", "ROLE_USER");
|
Supplier<Authentication> authentication = () -> new TestingAuthenticationToken("user", "password", "ROLE_USER");
|
||||||
MockMethodInvocation methodInvocation = new MockMethodInvocation(new ClassLevelAnnotations(),
|
MockMethodInvocation methodInvocation = new MockMethodInvocation(new TestClass(), TestClass.class,
|
||||||
ClassLevelAnnotations.class, "inheritedAnnotations");
|
"inheritedAnnotations");
|
||||||
MethodInvocationResult result = new MethodInvocationResult(methodInvocation, null);
|
MethodInvocationResult result = new MethodInvocationResult(methodInvocation, null);
|
||||||
PostAuthorizeAuthorizationManager manager = new PostAuthorizeAuthorizationManager();
|
PostAuthorizeAuthorizationManager manager = new PostAuthorizeAuthorizationManager();
|
||||||
assertThatExceptionOfType(AnnotationConfigurationException.class)
|
assertThatExceptionOfType(AnnotationConfigurationException.class)
|
||||||
|
@ -165,8 +165,8 @@ public class PostAuthorizeReactiveAuthorizationManagerTests {
|
|||||||
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 ClassLevelAnnotations(),
|
MockMethodInvocation methodInvocation = new MockMethodInvocation(new TestClass(), TestClass.class,
|
||||||
ClassLevelAnnotations.class, "inheritedAnnotations");
|
"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)
|
||||||
|
@ -120,8 +120,8 @@ public class PostFilterAuthorizationMethodInterceptorTests {
|
|||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void checkInheritedAnnotationsWhenConflictingThenAnnotationConfigurationException() throws Exception {
|
public void checkInheritedAnnotationsWhenConflictingThenAnnotationConfigurationException() throws Exception {
|
||||||
MockMethodInvocation methodInvocation = new MockMethodInvocation(new ConflictingAnnotations(),
|
MockMethodInvocation methodInvocation = new MockMethodInvocation(new TestClass(), TestClass.class,
|
||||||
ConflictingAnnotations.class, "inheritedAnnotations");
|
"inheritedAnnotations");
|
||||||
PostFilterAuthorizationMethodInterceptor advice = new PostFilterAuthorizationMethodInterceptor();
|
PostFilterAuthorizationMethodInterceptor advice = new PostFilterAuthorizationMethodInterceptor();
|
||||||
assertThatExceptionOfType(AnnotationConfigurationException.class)
|
assertThatExceptionOfType(AnnotationConfigurationException.class)
|
||||||
.isThrownBy(() -> advice.invoke(methodInvocation));
|
.isThrownBy(() -> advice.invoke(methodInvocation));
|
||||||
@ -230,16 +230,6 @@ public class PostFilterAuthorizationMethodInterceptorTests {
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public static class ConflictingAnnotations implements InterfaceAnnotationsThree {
|
|
||||||
|
|
||||||
@Override
|
|
||||||
@PostFilter("filterObject == 'jack'")
|
|
||||||
public void inheritedAnnotations() {
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
public interface InterfaceAnnotationsOne {
|
public interface InterfaceAnnotationsOne {
|
||||||
|
|
||||||
@PostFilter("filterObject == 'jim'")
|
@PostFilter("filterObject == 'jim'")
|
||||||
|
@ -116,8 +116,8 @@ public class PostFilterAuthorizationReactiveMethodInterceptorTests {
|
|||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void checkInheritedAnnotationsWhenConflictingThenAnnotationConfigurationException() throws Exception {
|
public void checkInheritedAnnotationsWhenConflictingThenAnnotationConfigurationException() throws Exception {
|
||||||
MockMethodInvocation methodInvocation = new MockMethodInvocation(new ConflictingAnnotations(),
|
MockMethodInvocation methodInvocation = new MockMethodInvocation(new TestClass(), TestClass.class,
|
||||||
ConflictingAnnotations.class, "inheritedAnnotations");
|
"inheritedAnnotations");
|
||||||
PostFilterAuthorizationReactiveMethodInterceptor interceptor = new PostFilterAuthorizationReactiveMethodInterceptor();
|
PostFilterAuthorizationReactiveMethodInterceptor interceptor = new PostFilterAuthorizationReactiveMethodInterceptor();
|
||||||
assertThatExceptionOfType(AnnotationConfigurationException.class)
|
assertThatExceptionOfType(AnnotationConfigurationException.class)
|
||||||
.isThrownBy(() -> interceptor.invoke(methodInvocation));
|
.isThrownBy(() -> interceptor.invoke(methodInvocation));
|
||||||
@ -155,16 +155,6 @@ public class PostFilterAuthorizationReactiveMethodInterceptorTests {
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public static class ConflictingAnnotations implements InterfaceAnnotationsThree {
|
|
||||||
|
|
||||||
@Override
|
|
||||||
@PostFilter("filterObject == 'jack'")
|
|
||||||
public void inheritedAnnotations() {
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
public interface InterfaceAnnotationsOne {
|
public interface InterfaceAnnotationsOne {
|
||||||
|
|
||||||
@PostFilter("filterObject == 'jim'")
|
@PostFilter("filterObject == 'jim'")
|
||||||
|
@ -127,8 +127,8 @@ public class PreAuthorizeAuthorizationManagerTests {
|
|||||||
@Test
|
@Test
|
||||||
public void checkInheritedAnnotationsWhenConflictingThenAnnotationConfigurationException() throws Exception {
|
public void checkInheritedAnnotationsWhenConflictingThenAnnotationConfigurationException() throws Exception {
|
||||||
Supplier<Authentication> authentication = () -> new TestingAuthenticationToken("user", "password", "ROLE_USER");
|
Supplier<Authentication> authentication = () -> new TestingAuthenticationToken("user", "password", "ROLE_USER");
|
||||||
MockMethodInvocation methodInvocation = new MockMethodInvocation(new ClassLevelAnnotations(),
|
MockMethodInvocation methodInvocation = new MockMethodInvocation(new TestClass(), TestClass.class,
|
||||||
ClassLevelAnnotations.class, "inheritedAnnotations");
|
"inheritedAnnotations");
|
||||||
PreAuthorizeAuthorizationManager manager = new PreAuthorizeAuthorizationManager();
|
PreAuthorizeAuthorizationManager manager = new PreAuthorizeAuthorizationManager();
|
||||||
assertThatExceptionOfType(AnnotationConfigurationException.class)
|
assertThatExceptionOfType(AnnotationConfigurationException.class)
|
||||||
.isThrownBy(() -> manager.check(authentication, methodInvocation));
|
.isThrownBy(() -> manager.check(authentication, methodInvocation));
|
||||||
|
@ -138,8 +138,8 @@ public class PreAuthorizeReactiveAuthorizationManagerTests {
|
|||||||
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 ClassLevelAnnotations(),
|
MockMethodInvocation methodInvocation = new MockMethodInvocation(new TestClass(), TestClass.class,
|
||||||
ClassLevelAnnotations.class, "inheritedAnnotations");
|
"inheritedAnnotations");
|
||||||
PreAuthorizeReactiveAuthorizationManager manager = new PreAuthorizeReactiveAuthorizationManager();
|
PreAuthorizeReactiveAuthorizationManager manager = new PreAuthorizeReactiveAuthorizationManager();
|
||||||
assertThatExceptionOfType(AnnotationConfigurationException.class)
|
assertThatExceptionOfType(AnnotationConfigurationException.class)
|
||||||
.isThrownBy(() -> manager.check(authentication, methodInvocation));
|
.isThrownBy(() -> manager.check(authentication, methodInvocation));
|
||||||
|
@ -180,8 +180,8 @@ public class PreFilterAuthorizationMethodInterceptorTests {
|
|||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void checkInheritedAnnotationsWhenConflictingThenAnnotationConfigurationException() throws Exception {
|
public void checkInheritedAnnotationsWhenConflictingThenAnnotationConfigurationException() throws Exception {
|
||||||
MockMethodInvocation methodInvocation = new MockMethodInvocation(new ConflictingAnnotations(),
|
MockMethodInvocation methodInvocation = new MockMethodInvocation(new TestClass(), TestClass.class,
|
||||||
ConflictingAnnotations.class, "inheritedAnnotations");
|
"inheritedAnnotations");
|
||||||
PreFilterAuthorizationMethodInterceptor advice = new PreFilterAuthorizationMethodInterceptor();
|
PreFilterAuthorizationMethodInterceptor advice = new PreFilterAuthorizationMethodInterceptor();
|
||||||
assertThatExceptionOfType(AnnotationConfigurationException.class)
|
assertThatExceptionOfType(AnnotationConfigurationException.class)
|
||||||
.isThrownBy(() -> advice.invoke(methodInvocation));
|
.isThrownBy(() -> advice.invoke(methodInvocation));
|
||||||
@ -297,16 +297,6 @@ public class PreFilterAuthorizationMethodInterceptorTests {
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public static class ConflictingAnnotations implements InterfaceAnnotationsThree {
|
|
||||||
|
|
||||||
@Override
|
|
||||||
@PreFilter("filterObject == 'jack'")
|
|
||||||
public void inheritedAnnotations() {
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
public interface InterfaceAnnotationsOne {
|
public interface InterfaceAnnotationsOne {
|
||||||
|
|
||||||
@PreFilter("filterObject == 'jim'")
|
@PreFilter("filterObject == 'jim'")
|
||||||
|
@ -151,8 +151,8 @@ public class PreFilterAuthorizationReactiveMethodInterceptorTests {
|
|||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void checkInheritedAnnotationsWhenConflictingThenAnnotationConfigurationException() throws Exception {
|
public void checkInheritedAnnotationsWhenConflictingThenAnnotationConfigurationException() throws Exception {
|
||||||
MockMethodInvocation methodInvocation = new MockMethodInvocation(new ConflictingAnnotations(),
|
MockMethodInvocation methodInvocation = new MockMethodInvocation(new TestClass(), TestClass.class,
|
||||||
ConflictingAnnotations.class, "inheritedAnnotations");
|
"inheritedAnnotations");
|
||||||
PreFilterAuthorizationReactiveMethodInterceptor interceptor = new PreFilterAuthorizationReactiveMethodInterceptor();
|
PreFilterAuthorizationReactiveMethodInterceptor interceptor = new PreFilterAuthorizationReactiveMethodInterceptor();
|
||||||
assertThatExceptionOfType(AnnotationConfigurationException.class)
|
assertThatExceptionOfType(AnnotationConfigurationException.class)
|
||||||
.isThrownBy(() -> interceptor.invoke(methodInvocation));
|
.isThrownBy(() -> interceptor.invoke(methodInvocation));
|
||||||
@ -200,16 +200,6 @@ public class PreFilterAuthorizationReactiveMethodInterceptorTests {
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public static class ConflictingAnnotations implements InterfaceAnnotationsThree {
|
|
||||||
|
|
||||||
@Override
|
|
||||||
@PreFilter("filterObject == 'jack'")
|
|
||||||
public void inheritedAnnotations() {
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
public interface InterfaceAnnotationsOne {
|
public interface InterfaceAnnotationsOne {
|
||||||
|
|
||||||
@PreFilter("filterObject == 'jim'")
|
@PreFilter("filterObject == 'jim'")
|
||||||
|
@ -147,8 +147,8 @@ public class SecuredAuthorizationManagerTests {
|
|||||||
@Test
|
@Test
|
||||||
public void checkInheritedAnnotationsWhenConflictingThenAnnotationConfigurationException() throws Exception {
|
public void checkInheritedAnnotationsWhenConflictingThenAnnotationConfigurationException() throws Exception {
|
||||||
Supplier<Authentication> authentication = () -> new TestingAuthenticationToken("user", "password", "ROLE_USER");
|
Supplier<Authentication> authentication = () -> new TestingAuthenticationToken("user", "password", "ROLE_USER");
|
||||||
MockMethodInvocation methodInvocation = new MockMethodInvocation(new ClassLevelAnnotations(),
|
MockMethodInvocation methodInvocation = new MockMethodInvocation(new TestClass(), TestClass.class,
|
||||||
ClassLevelAnnotations.class, "inheritedAnnotations");
|
"inheritedAnnotations");
|
||||||
SecuredAuthorizationManager manager = new SecuredAuthorizationManager();
|
SecuredAuthorizationManager manager = new SecuredAuthorizationManager();
|
||||||
assertThatExceptionOfType(AnnotationConfigurationException.class)
|
assertThatExceptionOfType(AnnotationConfigurationException.class)
|
||||||
.isThrownBy(() -> manager.check(authentication, methodInvocation));
|
.isThrownBy(() -> manager.check(authentication, methodInvocation));
|
||||||
|
Loading…
x
Reference in New Issue
Block a user