Source/UBCS/ubcs-service/ubcs-code/src/main/java/com/vci/ubcs/code/service/impl/PasswordFreeLoginServiceImpl.java
@@ -4,6 +4,7 @@
import com.vci.ubcs.code.entity.TokenUserObject;
import com.vci.ubcs.code.service.IPasswordFreeLoginService;
import com.vci.ubcs.starter.util.HttpUtils;
import com.vci.ubcs.system.cache.NacosConfigCache;
import io.jsonwebtoken.Claims;
import lombok.extern.slf4j.Slf4j;
import org.apache.http.auth.AuthenticationException;
@@ -66,6 +67,7 @@
   @Value("${password-free.secret-key:9fbd170bd83eb869}")
   private String secretKey;//应用秘钥
   @Autowired
   private BladeRedis bladeRedis;
@@ -106,7 +108,7 @@
      String token2 = JwtUtil.getToken(authToken);
      BladeUser user = this.getUser(token2);
      //不存在就请求
      if(Func.isEmpty(authToken) || Func.isEmpty(user)){
      if(Func.isEmpty(authToken) || Func.isEmpty(user) || !user.getTenantId().equals(NacosConfigCache.getAdminUserInfo().getTenantId())){
         String responseBody = this.passwordFreeLogin(userName);
         //拿到响应体其中包含token,用request中的ip地址作为键值,将token存入缓存
         TokenUserObject tokenUserObject = null;
@@ -122,8 +124,9 @@
         token2 = JwtUtil.getToken(authToken);
         user = this.getUser(token2);
      }
      //request.setAttribute("Blade-Auth",token);
      request.setAttribute("Blade-Auth",authToken);
      request.setAttribute("_BLADE_USER_REQUEST_ATTR_",user);
      request.setAttribute("Authorization",authToken);
      return true;
   }
@@ -161,26 +164,25 @@
   /**
    * 单点登录
    * @param servletRequest
    * @param empCode
    * @return
    * @throws Exception
    */
   @Override
   public String ssoFreeLogin(ServletRequest servletRequest) throws Exception {
      HttpServletRequest request = (HttpServletRequest) servletRequest;
      String content = request.getHeader("empCode");
      if(Func.isBlank(content)){
   public String ssoFreeLogin(String empCode) throws Exception {
      if(Func.isBlank(empCode)){
         throw new ServiceException("未获取到empCode参数");
      }
      //加密
      String str1 = aesEncrypt(content, clientId);
      String str2 = aesEncrypt(str1, secretKey);
      String enStr1 = aesDecrypt(str2, secretKey);
      String enStr2 = aesDecrypt(enStr1, clientId);
      String enStr2;
      try {
         String enStr1 = aesDecrypt(empCode, secretKey);
         enStr2 = aesDecrypt(enStr1, clientId);
      }catch (Exception e){
         throw new ServiceException("empCode参数解密失败!原因:"+e.getMessage());
      }
      // 解密
      log.debug("单点登录参数解密后:"+enStr2);
      String token = this.passwordFreeLogin("pwdfree");
      String token = this.passwordFreeLogin(enStr2);
      return token;
   }