Performance: Authentication flow
MEDIUM IMPACT
This affects page load speed and interaction responsiveness by controlling how quickly users can access protected content after login.
public CompletableFuture<String> loginAsync(HttpServletRequest request) {
return externalAuthService.validateAsync(request.getParameter("token"))
.thenApply(valid -> {
if (valid) {
request.getSession().setAttribute("user", "authenticated");
return "home";
} else {
return "login";
}
});
}public String login(HttpServletRequest request) {
// Synchronous call to external auth service
boolean valid = externalAuthService.validate(request.getParameter("token"));
if (valid) {
request.getSession().setAttribute("user", "authenticated");
return "home";
} else {
return "login";
}
}| Pattern | Server Blocking | Response Delay | User Interaction Delay | Verdict |
|---|---|---|---|---|
| Synchronous external auth call | High (blocks thread) | 200-500ms | High delay in login response | [X] Bad |
| Asynchronous external auth call | Low (non-blocking) | Minimal | Fast login response | [OK] Good |