Performance: Why authorization matters
MEDIUM IMPACT
Authorization affects server response time and user experience by controlling access to resources, impacting backend processing and frontend rendering speed.
@PreAuthorize("hasRole('USER')") public String getUserData() { return fetchData(); }
public String getUserData() {
if (!userHasAccess()) {
throw new AccessDeniedException();
}
return fetchData();
}| Pattern | Backend Processing | Network Impact | Frontend Rendering | Verdict |
|---|---|---|---|---|
| Late manual authorization checks | High CPU usage | Increased response time | Delayed content display | [X] Bad |
| Declarative authorization with annotations | Low CPU usage | Faster response | Quicker content display | [OK] Good |