Performance: Method-level security
MEDIUM IMPACT
Method-level security affects server-side request processing speed and response time by adding authorization checks before method execution.
@PreAuthorize("hasRole('ADMIN')")
public void processData() {
// method logic
}@PreAuthorize("hasRole('ADMIN') or (hasRole('USER') and authentication.name == 'special')")
public void processData() {
// method logic
}| Pattern | Authorization Checks | Server Latency | Browser Impact | Verdict |
|---|---|---|---|---|
| Complex nested @PreAuthorize expressions | Multiple evaluations per call | Adds 5-10ms latency | No direct impact | [X] Bad |
| Simple @PreAuthorize with caching | Single evaluation per call | Adds 1-3ms latency | No direct impact | [OK] Good |