| 
					
				 | 
			
			
				@@ -4,9 +4,11 @@ import com.ym.mec.auth.api.dto.SysUserInfo; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 import com.ym.mec.auth.config.token.PhoneAuthenticationToken; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 import com.ym.mec.auth.service.SysUserService; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 import com.ym.mec.common.security.SecurityConstants; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+import com.ym.mec.common.service.IdGeneratorService; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 import org.apache.commons.lang3.StringUtils; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 import org.springframework.security.authentication.AbstractAuthenticationToken; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 import org.springframework.security.authentication.AuthenticationServiceException; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+import org.springframework.security.authentication.BadCredentialsException; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 import org.springframework.security.authentication.LockedException; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 import org.springframework.security.core.Authentication; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 import org.springframework.security.core.AuthenticationException; 
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@@ -31,6 +33,7 @@ public class PhoneLoginAuthenticationFilter extends AbstractAuthenticationProces 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 	private boolean postOnly = true; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 	 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 	private SysUserService sysUserService; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+	private IdGeneratorService smsCodeService; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				  
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 	public PhoneLoginAuthenticationFilter() { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 		super(new AntPathRequestMatcher(SPRING_SECURITY_RESTFUL_LOGIN_URL, "POST")); 
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@@ -49,6 +52,9 @@ public class PhoneLoginAuthenticationFilter extends AbstractAuthenticationProces 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 		String isRegister = obtainParameter(request, IS_REGISTER_PARAMETER); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 		//是否是租户 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 		String isLessee = obtainParameter(request, IS_LESSEE); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+		// 验证码验证 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+		boolean b = smsCodeService.verifyValidCode(StringUtils.substringAfter(principal, SecurityConstants.PHONE_PRINCIPAL_PREFIX), credentials); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+		if(!b) throw new BadCredentialsException("验证码校验失败"); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				  
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 		SysUserInfo userInfo = sysUserService.queryUserInfoByPhone(principal); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				  
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@@ -93,4 +99,7 @@ public class PhoneLoginAuthenticationFilter extends AbstractAuthenticationProces 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 		this.sysUserService = sysUserService; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 	} 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				  
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+	public void setSmsCodeService(IdGeneratorService smsCodeService) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+		this.smsCodeService = smsCodeService; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+	} 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 } 
			 |