From b904a46bca651a0c8b254392e5a6d92f6aeb7c99 Mon Sep 17 00:00:00 2001 From: Anthony Stirling <77850077+Frooodle@users.noreply.github.com> Date: Sat, 18 May 2024 19:39:35 +0100 Subject: [PATCH] Update CustomAuthenticationSuccessHandler.java --- .../config/security/CustomAuthenticationSuccessHandler.java | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/main/java/stirling/software/SPDF/config/security/CustomAuthenticationSuccessHandler.java b/src/main/java/stirling/software/SPDF/config/security/CustomAuthenticationSuccessHandler.java index 3d9bb9fa..28b1b426 100644 --- a/src/main/java/stirling/software/SPDF/config/security/CustomAuthenticationSuccessHandler.java +++ b/src/main/java/stirling/software/SPDF/config/security/CustomAuthenticationSuccessHandler.java @@ -2,6 +2,7 @@ package stirling.software.SPDF.config.security; import java.io.IOException; +import org.springframework.beans.factory.annotation.Autowired; import org.springframework.security.core.Authentication; import org.springframework.security.web.authentication.SavedRequestAwareAuthenticationSuccessHandler; import org.springframework.security.web.savedrequest.SavedRequest; @@ -16,11 +17,14 @@ import stirling.software.SPDF.utils.RequestUriUtils; @Component public class CustomAuthenticationSuccessHandler extends SavedRequestAwareAuthenticationSuccessHandler { + @Autowired private LoginAttemptService loginAttemptService; @Override public void onAuthenticationSuccess( HttpServletRequest request, HttpServletResponse response, Authentication authentication) throws ServletException, IOException { + String username = request.getParameter("username"); + loginAttemptService.loginSucceeded(username); // Get the saved request HttpSession session = request.getSession(false); SavedRequest savedRequest =