Using interceptors to enforce security
While security is an important aspect of many applications, the use of programmatic security can clutter up business logic. The use of declarative annotations has come a long way in making security easier to use and less intrusive. However, there are still times when programmatic security is necessary. When it is, then the use of interceptors can help remove the security code from the business logic.
The process for using an interceptor to enforce security involves:
- Configuring and enabling security for the application server
- Adding a @DeclareRoles to the target class and the interceptor class
- Creating a security interceptor
How to do it...
Configure the application to handle security as detailed ...