Which annotation is used in Spring Security to secure methods based on role-based conditions?
- @Permission
- @PostAuthorize
- @PreAuthorize
- @Secured
The @Secured annotation in Spring Security is used to secure methods based on role-based conditions. You can specify the required roles in the annotation, and only users with those roles can access the method.
Loading...
Related Quiz
- In a complex Spring Boot application with numerous controllers and a global exception handler, a new requirement mandates the implementation of controller-specific exception handlers. How would you approach this requirement to provide custom error responses from individual controllers while maintaining the functionality of the global exception handler?
- In a Spring Boot application, how would you secure microservices using OAuth2 and JWT?
- You need to implement a feature in a Spring Boot application where data is streamed from the server to the client as soon as it’s available. How would you implement this feature using reactive programming principles?
- Your Spring Boot application has complex business logic that involves interactions between various beans. How would you approach testing such business logic, ensuring that the interactions between beans are correct and that the business logic produces the expected outcomes?
- In the context of Global Method Security, how can custom permission evaluators be integrated to extend the functionality of method security expressions?