Skip to content

5.8.12: @Secured annotation on subclasses is not read by SecuredAuthorizationManager when method in superclass was called #15002

Open
@artem103

Description

@artem103

If I have 2 classes,

public abstract class AbstractService {
    public void doSmth() {...}
}

@Secured("SECURE")
@Service
public class Service extends AbstractService {
...
}

and when I call service.doSmth(), security is not applied, because method org.springframework.security.authorization.method.SecuredAuthorizationManager.SecuredAuthorizationManagerRegistry#findSecuredAnnotation will try to get annotation of AbstractService, not of Service.

See the 6 version of this method https://github.com/spring-projects/spring-security/blob/main/core/src/main/java/org/springframework/security/authorization/method/SecuredAuthorizationManager.java
This bug was fixed there.

Metadata

Metadata

Assignees

Labels

in: coreAn issue in spring-security-coretype: bugA general bug

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions