|
@@ -7,7 +7,9 @@ import com.zhongzheng.common.core.domain.model.TopLoginUser;
|
|
|
import com.zhongzheng.common.exception.CustomException;
|
|
|
import com.zhongzheng.common.utils.ServletUtils;
|
|
|
import com.zhongzheng.common.utils.ip.IpUtils;
|
|
|
+import com.zhongzheng.framework.web.service.SellerTokenService;
|
|
|
import com.zhongzheng.framework.web.service.TopTokenService;
|
|
|
+import com.zhongzheng.modules.user.entity.ClientLoginSeller;
|
|
|
import com.zhongzheng.modules.user.entity.ClientLoginUser;
|
|
|
import com.zhongzheng.common.core.domain.model.LoginUser;
|
|
|
import com.zhongzheng.common.utils.SecurityUtils;
|
|
@@ -45,6 +47,9 @@ public class JwtAuthenticationTokenFilter extends OncePerRequestFilter
|
|
|
@Autowired
|
|
|
private TopTokenService topTokenService;
|
|
|
|
|
|
+ @Autowired
|
|
|
+ private SellerTokenService sellerTokenService;
|
|
|
+
|
|
|
@Value("${mybatis-plus.tenant.enabled-tenant:true}")
|
|
|
private boolean enabledTenant;
|
|
|
|
|
@@ -54,7 +59,6 @@ public class JwtAuthenticationTokenFilter extends OncePerRequestFilter
|
|
|
{
|
|
|
try{
|
|
|
String wxToken = wxTokenService.getToken(request);
|
|
|
-
|
|
|
if(StringUtils.isNoneEmpty(wxToken)){
|
|
|
ClientLoginUser clientLoginUser = wxTokenService.getLoginUser(request);
|
|
|
if(clientLoginUser!=null){
|
|
@@ -75,18 +79,31 @@ public class JwtAuthenticationTokenFilter extends OncePerRequestFilter
|
|
|
SecurityContextHolder.getContext().setAuthentication(authenticationToken);
|
|
|
}
|
|
|
}else{
|
|
|
+ String sellerToken = sellerTokenService.getToken(request);
|
|
|
+ if(StringUtils.isNoneEmpty(sellerToken)){
|
|
|
+ //业务员系统
|
|
|
+ ClientLoginSeller clientLoginSeller = sellerTokenService.getLoginUser(request);
|
|
|
+ if(clientLoginSeller!=null){
|
|
|
+ sellerTokenService.verifyToken(clientLoginSeller);
|
|
|
+ UsernamePasswordAuthenticationToken authenticationToken = new UsernamePasswordAuthenticationToken(clientLoginSeller, null,null);
|
|
|
+ authenticationToken.setDetails(new WebAuthenticationDetailsSource().buildDetails(request));
|
|
|
+ SecurityContextHolder.getContext().setAuthentication(authenticationToken);
|
|
|
+ }
|
|
|
+ }else{
|
|
|
//子系统
|
|
|
- LoginUser loginUser = null;
|
|
|
+ LoginUser loginUser = null;
|
|
|
|
|
|
- loginUser = tokenService.getLoginUser(request);
|
|
|
+ loginUser = tokenService.getLoginUser(request);
|
|
|
|
|
|
- if (Validator.isNotNull(loginUser) && Validator.isNull(SecurityUtils.getAuthentication()))
|
|
|
- {
|
|
|
- tokenService.verifyToken(loginUser);
|
|
|
- UsernamePasswordAuthenticationToken authenticationToken = new UsernamePasswordAuthenticationToken(loginUser, null, loginUser.getAuthorities());
|
|
|
- authenticationToken.setDetails(new WebAuthenticationDetailsSource().buildDetails(request));
|
|
|
- SecurityContextHolder.getContext().setAuthentication(authenticationToken);
|
|
|
+ if (Validator.isNotNull(loginUser) && Validator.isNull(SecurityUtils.getAuthentication()))
|
|
|
+ {
|
|
|
+ tokenService.verifyToken(loginUser);
|
|
|
+ UsernamePasswordAuthenticationToken authenticationToken = new UsernamePasswordAuthenticationToken(loginUser, null, loginUser.getAuthorities());
|
|
|
+ authenticationToken.setDetails(new WebAuthenticationDetailsSource().buildDetails(request));
|
|
|
+ SecurityContextHolder.getContext().setAuthentication(authenticationToken);
|
|
|
+ }
|
|
|
}
|
|
|
+
|
|
|
}
|
|
|
|
|
|
}
|