Call authorization applies method-level rules to decide whether a method may run or whether its returned value may reach the caller. Method security is disabled by default; enabling it activates an aspect that intercepts protected calls. section 11.1 section 11.1.1
Use two authorization points:
- Preauthorization checks rules before delegation and blocks the method call when they fail. section 11.1.1
- Postauthorization allows execution, then checks whether the caller may receive the returned value. section 11.1.1
Restricting document lookup
A method such as findDocumentsByUser(String username) can use preauthorization to ensure the supplied username matches the authenticated user, preventing access to another user’s documents. section 11.1.1
Figure 11.2 When we enable global method security, an aspect intercepts the call to the protected method. If the given authorization rules aren’t respected, the aspect doesn’t delegate the call to the protected method.
Follow the interception flow from the protected method call to delegation or rejection. section 11.1.1
