| 
														
															@@ -3,6 +3,7 @@ package com.ym.mec.auth.core.handler; 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 import com.fasterxml.jackson.databind.ObjectMapper; 
														 | 
														
														 | 
														
															 import com.fasterxml.jackson.databind.ObjectMapper; 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 import com.ym.mec.auth.api.entity.SysUser; 
														 | 
														
														 | 
														
															 import com.ym.mec.auth.api.entity.SysUser; 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 import com.ym.mec.auth.api.entity.SysUserLogin; 
														 | 
														
														 | 
														
															 import com.ym.mec.auth.api.entity.SysUserLogin; 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 
														 | 
														
														 | 
														
															+import com.ym.mec.auth.config.constant.SecurityConstants; 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 import com.ym.mec.auth.service.SysUserLoginService; 
														 | 
														
														 | 
														
															 import com.ym.mec.auth.service.SysUserLoginService; 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 import com.ym.mec.auth.service.SysUserService; 
														 | 
														
														 | 
														
															 import com.ym.mec.auth.service.SysUserService; 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 import org.slf4j.Logger; 
														 | 
														
														 | 
														
															 import org.slf4j.Logger; 
														 | 
													
												
											
										
											
												
													
														 | 
														
															@@ -31,11 +32,15 @@ public class AuthenticationFailureListener implements ApplicationListener<Authen 
														 | 
													
												
											
												
													
														| 
														 | 
														
															     public void onApplicationEvent(AuthenticationFailureBadCredentialsEvent authenticationFailureBadCredentialsEvent) { 
														 | 
														
														 | 
														
															     public void onApplicationEvent(AuthenticationFailureBadCredentialsEvent authenticationFailureBadCredentialsEvent) { 
														 | 
													
												
											
												
													
														| 
														 | 
														
															         Authentication authentication = authenticationFailureBadCredentialsEvent.getAuthentication(); 
														 | 
														
														 | 
														
															         Authentication authentication = authenticationFailureBadCredentialsEvent.getAuthentication(); 
														 | 
													
												
											
												
													
														| 
														 | 
														
															         HashMap<String,String> hashMap = objectMapper.convertValue(authentication.getDetails(), HashMap.class); 
														 | 
														
														 | 
														
															         HashMap<String,String> hashMap = objectMapper.convertValue(authentication.getDetails(), HashMap.class); 
														 | 
													
												
											
												
													
														| 
														 | 
														
															-        String account = authentication.getPrincipal().toString(); 
														 | 
														
														 | 
														
															 
														 | 
													
												
											
												
													
														| 
														 | 
														
															-        SysUser sysUser = sysUserService.queryByUsername(account); 
														 | 
														
														 | 
														
															 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 
														 | 
														
														 | 
														
															+        String username = authentication.getPrincipal().toString(); 
														 | 
													
												
											
												
													
														| 
														 | 
														
															         Date date = new Date(); 
														 | 
														
														 | 
														
															         Date date = new Date(); 
														 | 
													
												
											
												
													
														| 
														 | 
														
															-        if(sysUser == null){ 
														 | 
														
														 | 
														
															 
														 | 
													
												
											
												
													
														| 
														 | 
														
															-            sysUser = sysUserService.queryByPhone(account); 
														 | 
														
														 | 
														
															 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 
														 | 
														
														 | 
														
															+        SysUser sysUser = null; 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 
														 | 
														
														 | 
														
															+        if(username.split(":").length > 1){ 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 
														 | 
														
														 | 
														
															+            if(username.startsWith(SecurityConstants.USERNAME_PRINCIPAL_PREFIX)){ 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 
														 | 
														
														 | 
														
															+                sysUser = sysUserService.queryByUsername(username.split(":")[1]); 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 
														 | 
														
														 | 
														
															+            }else { 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 
														 | 
														
														 | 
														
															+                sysUser = sysUserService.queryByPhone(username.split(":")[1]); 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 
														 | 
														
														 | 
														
															+            } 
														 | 
													
												
											
												
													
														| 
														 | 
														
															         } 
														 | 
														
														 | 
														
															         } 
														 | 
													
												
											
												
													
														| 
														 | 
														
															         if(sysUser != null){ 
														 | 
														
														 | 
														
															         if(sysUser != null){ 
														 | 
													
												
											
												
													
														| 
														 | 
														
															             SysUserLogin userLogin = sysUserLoginService.findLoginByUserId(sysUser.getUserId()); 
														 | 
														
														 | 
														
															             SysUserLogin userLogin = sysUserLoginService.findLoginByUserId(sysUser.getUserId()); 
														 | 
													
												
											
										
											
												
													
														 | 
														
															@@ -61,7 +66,7 @@ public class AuthenticationFailureListener implements ApplicationListener<Authen 
														 | 
													
												
											
												
													
														| 
														 | 
														
															             } 
														 | 
														
														 | 
														
															             } 
														 | 
													
												
											
												
													
														| 
														 | 
														
															             logger.info("用户:{} 登录失败", sysUser.getPhone()); 
														 | 
														
														 | 
														
															             logger.info("用户:{} 登录失败", sysUser.getPhone()); 
														 | 
													
												
											
												
													
														| 
														 | 
														
															         }else { 
														 | 
														
														 | 
														
															         }else { 
														 | 
													
												
											
												
													
														| 
														 | 
														
															-            logger.info("用户:{} 不存在", account); 
														 | 
														
														 | 
														
															 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 
														 | 
														
														 | 
														
															+            logger.info("用户:{} 不存在", username); 
														 | 
													
												
											
												
													
														| 
														 | 
														
															         } 
														 | 
														
														 | 
														
															         } 
														 | 
													
												
											
												
													
														| 
														 | 
														
															     } 
														 | 
														
														 | 
														
															     } 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 } 
														 | 
														
														 | 
														
															 } 
														 |