|
@@ -1,12 +1,9 @@
|
|
|
package com.keao.edu.auth.core.filter;
|
|
|
|
|
|
-import java.io.IOException;
|
|
|
-
|
|
|
-import javax.servlet.FilterChain;
|
|
|
-import javax.servlet.ServletException;
|
|
|
-import javax.servlet.http.HttpServletRequest;
|
|
|
-import javax.servlet.http.HttpServletResponse;
|
|
|
-
|
|
|
+import com.keao.edu.auth.api.entity.LoginEntity;
|
|
|
+import com.keao.edu.auth.api.util.SecurityConstants;
|
|
|
+import com.keao.edu.auth.config.token.PhoneAuthenticationToken;
|
|
|
+import com.keao.edu.datasource.DataSourceContextHolder;
|
|
|
import org.apache.commons.lang3.StringUtils;
|
|
|
import org.springframework.security.authentication.AbstractAuthenticationToken;
|
|
|
import org.springframework.security.authentication.AuthenticationServiceException;
|
|
@@ -15,10 +12,11 @@ import org.springframework.security.core.AuthenticationException;
|
|
|
import org.springframework.security.web.authentication.AbstractAuthenticationProcessingFilter;
|
|
|
import org.springframework.security.web.util.matcher.AntPathRequestMatcher;
|
|
|
|
|
|
-import com.keao.edu.auth.api.entity.LoginEntity;
|
|
|
-import com.keao.edu.auth.api.util.SecurityConstants;
|
|
|
-import com.keao.edu.auth.config.token.PhoneAuthenticationToken;
|
|
|
-import com.keao.edu.datasource.DataSourceContextHolder;
|
|
|
+import javax.servlet.FilterChain;
|
|
|
+import javax.servlet.ServletException;
|
|
|
+import javax.servlet.http.HttpServletRequest;
|
|
|
+import javax.servlet.http.HttpServletResponse;
|
|
|
+import java.io.IOException;
|
|
|
|
|
|
public class PhoneLoginAuthenticationFilter extends AbstractAuthenticationProcessingFilter {
|
|
|
|
|
@@ -26,6 +24,8 @@ public class PhoneLoginAuthenticationFilter extends AbstractAuthenticationProces
|
|
|
private static final String SPRING_SECURITY_RESTFUL_VERIFY_CODE_KEY = "smsCode";
|
|
|
private static final String clientIdParameter = "clientId";
|
|
|
private static final String tenantIdParameter = "tenantId";
|
|
|
+ private static final String registerFlagParameter = "registerFlag";
|
|
|
+ private static final String organIdParameter = "organId";
|
|
|
|
|
|
private static final String SPRING_SECURITY_RESTFUL_LOGIN_URL = "/smsLogin";
|
|
|
private boolean postOnly = true;
|
|
@@ -63,6 +63,11 @@ public class PhoneLoginAuthenticationFilter extends AbstractAuthenticationProces
|
|
|
loginEntity.setClientId(clientId);
|
|
|
loginEntity.setPhone(principal);
|
|
|
loginEntity.setSmsCode(credentials);
|
|
|
+ String organId = obtainParameter(request, organIdParameter);
|
|
|
+ if(StringUtils.isNotEmpty(organId)){
|
|
|
+ loginEntity.setOrganId(Integer.parseInt(organId));
|
|
|
+ }
|
|
|
+ loginEntity.setRegisterFlag(obtainParameter(request, registerFlagParameter));
|
|
|
|
|
|
authRequest = new PhoneAuthenticationToken(SecurityConstants.PHONE_PRINCIPAL_PREFIX + principal, loginEntity);
|
|
|
|