Merge branch '6.4.x'

This commit is contained in:
Josh Cummings
2025-03-17 11:02:47 -06:00
2 changed files with 115 additions and 7 deletions

View File

@@ -295,6 +295,30 @@ public class UniqueSecurityAnnotationScannerTests {
.isThrownBy(() -> this.parameterScanner.scan(parameter));
}
// gh-16751
@Test
void scanWhenAnnotationOnParameterizedInterfaceTheLocates() throws Exception {
Method method = MyServiceImpl.class.getDeclaredMethod("get", String.class);
PreAuthorize pre = this.scanner.scan(method, method.getDeclaringClass());
assertThat(pre).isNotNull();
}
// gh-16751
@Test
void scanWhenAnnotationOnParameterizedSuperClassThenLocates() throws Exception {
Method method = MyServiceImpl.class.getDeclaredMethod("getExt", Long.class);
PreAuthorize pre = this.scanner.scan(method, method.getDeclaringClass());
assertThat(pre).isNotNull();
}
// gh-16751
@Test
void scanWhenAnnotationOnParameterizedMethodThenLocates() throws Exception {
Method method = MyServiceImpl.class.getDeclaredMethod("getExtByClass", Class.class, Long.class);
PreAuthorize pre = this.scanner.scan(method, method.getDeclaringClass());
assertThat(pre).isNotNull();
}
interface UserService {
void add(@CustomParameterAnnotation("one") String user);
@@ -681,4 +705,40 @@ public class UniqueSecurityAnnotationScannerTests {
}
interface MyService<C, U> {
@PreAuthorize("thirty")
C get(U u);
}
abstract static class MyServiceExt<T> implements MyService<Integer, String> {
@PreAuthorize("thirtyone")
abstract T getExt(T t);
@PreAuthorize("thirtytwo")
abstract <S extends Number> S getExtByClass(Class<S> clazz, T t);
}
static class MyServiceImpl extends MyServiceExt<Long> {
@Override
public Integer get(final String s) {
return 0;
}
@Override
Long getExt(Long o) {
return 0L;
}
@Override
<S extends Number> S getExtByClass(Class<S> clazz, Long l) {
return null;
}
}
}