From c83e4c6f74b6508eb33de9b22d618d0632901cc9 Mon Sep 17 00:00:00 2001 From: ShinDongHun1 Date: Tue, 15 Mar 2022 21:39:46 +0900 Subject: [PATCH] refactor UsernamePasswordAuthenticationFilter method --- .../authentication/UsernamePasswordAuthenticationFilter.java | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/web/src/main/java/org/springframework/security/web/authentication/UsernamePasswordAuthenticationFilter.java b/web/src/main/java/org/springframework/security/web/authentication/UsernamePasswordAuthenticationFilter.java index c5323077d88..a941cfeb592 100644 --- a/web/src/main/java/org/springframework/security/web/authentication/UsernamePasswordAuthenticationFilter.java +++ b/web/src/main/java/org/springframework/security/web/authentication/UsernamePasswordAuthenticationFilter.java @@ -75,8 +75,7 @@ public Authentication attemptAuthentication(HttpServletRequest request, HttpServ throw new AuthenticationServiceException("Authentication method not supported: " + request.getMethod()); } String username = obtainUsername(request); - username = (username != null) ? username : ""; - username = username.trim(); + username = (username != null) ? username.trim() : ""; String password = obtainPassword(request); password = (password != null) ? password : ""; UsernamePasswordAuthenticationToken authRequest = UsernamePasswordAuthenticationToken.unauthenticated(username,