Challenge: Spring Aspect Orientated Programming (AOP)

Test your understanding of aspect-oriented programming and security in Spring Boot by implementing a security aspect that checks user authorization before sensitive operations.

Problem statement

Assume you have an existing Spring Boot application for an e-commerce Ebook store. The application currently has a method to update the title of the ebook, but it lacks proper security checks. Your task is to implement a security aspect that checks user authorization before allowing the title update. Additionally, you need to authenticate the user before any action in the data layer is performed.

The currently, the EbookRepository extends the RepositoryJpa interface to perform CRUD operations. You can use the following expression to intercept its methods like save, findById, findAll, etc.

Level up your interview prep. Join Educative to access 80+ hands-on prep courses.