| | |
| | | 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; |
| | |
| | | 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; |
| | |
| | | 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; |
| | | } |
| | | |
| | |
| | | } |
| | | String enStr2; |
| | | try { |
| | | /*String pwdfree = aesEncrypt("pwdfree", secretKey); |
| | | String s = aesEncrypt(pwdfree, clientId);*/ |
| | | // String enStr1 = aesDecrypt(empCode, secretKey); |
| | | // enStr2 = aesDecrypt(enStr1, clientId); |
| | | String enStr1 = aesDecrypt(empCode, secretKey); |
| | | enStr2 = aesDecrypt(enStr1, clientId); |
| | | }catch (Exception e){ |
| | | throw new ServiceException("empCode参数解密失败!原因:"+e.getCause()); |
| | | throw new ServiceException("empCode参数解密失败!原因:"+e.getMessage()); |
| | | } |
| | | // 解密 |
| | | //log.debug("单点登录参数解密后:"+enStr2); |
| | | String token = this.passwordFreeLogin("pwdfree"); |
| | | log.debug("单点登录参数解密后:"+enStr2); |
| | | String token = this.passwordFreeLogin(enStr2); |
| | | return token; |
| | | } |
| | | |