Skip to content

Commit 76a3b15

Browse files
The SecuredAuthorizationManager can now find @secured annotations on subclasses when a method in the superclass is called.
Format the code and closes the issue spring-projects#15002
1 parent 01718bd commit 76a3b15

File tree

2 files changed

+6
-2
lines changed

2 files changed

+6
-2
lines changed

core/src/main/java/org/springframework/security/authorization/method/SecuredAuthorizationManager.java

+2-1
Original file line numberDiff line numberDiff line change
@@ -67,7 +67,8 @@ AuthorizationManager<MethodInvocation> resolveManager(Method method, Class<?> ta
6767

6868
private Secured findSecuredAnnotation(Method method, Class<?> targetClass) {
6969
Secured secured = AuthorizationAnnotationUtils.findUniqueAnnotation(method, Secured.class);
70-
return (secured != null) ? secured : AuthorizationAnnotationUtils.findUniqueAnnotation((targetClass != null) ? targetClass : method.getDeclaringClass(), Secured.class);
70+
return (secured != null) ? secured : AuthorizationAnnotationUtils
71+
.findUniqueAnnotation((targetClass != null) ? targetClass : method.getDeclaringClass(), Secured.class);
7172
}
7273

7374
}

core/src/test/java/org/springframework/security/authorization/method/SecuredAuthorizationManagerTests.java

+4-1
Original file line numberDiff line numberDiff line change
@@ -244,7 +244,10 @@ public void inheritedAnnotations() {
244244
}
245245

246246
public abstract class AbstractService {
247-
public void doSmth() {}
247+
248+
public void doSmth() {
249+
}
250+
248251
}
249252

250253
@Secured("SECURE")

0 commit comments

Comments
 (0)