|
@@ -56,12 +56,14 @@ import org.springblade.system.cache.ParamCache;
|
|
|
import org.springblade.system.user.bean.CyGetToken;
|
|
|
import org.springblade.system.user.bean.ResultCYData;
|
|
|
import org.springblade.system.user.bean.ResultCYKey;
|
|
|
+import org.springblade.system.user.dto.TokenVerifyResult;
|
|
|
import org.springblade.system.user.dto.UserDTO;
|
|
|
import org.springblade.system.user.entity.User;
|
|
|
import org.springblade.system.user.excel.UserExcel;
|
|
|
import org.springblade.system.user.excel.UserExcel2;
|
|
|
import org.springblade.system.user.excel.UserImporter;
|
|
|
import org.springblade.system.user.service.IUserService;
|
|
|
+import org.springblade.system.user.util.RSA256Utils;
|
|
|
import org.springblade.system.user.util.RsaUtils;
|
|
|
import org.springblade.system.user.vo.UserVO;
|
|
|
import org.springblade.system.user.wrapper.UserWrapper;
|
|
@@ -474,7 +476,7 @@ public class UserController {
|
|
|
@PostMapping("/loginByToken")
|
|
|
@ApiOperationSupport(order = 20)
|
|
|
@ApiOperation(value = "token验证加密", notes = "token验证登录")
|
|
|
- public R loginByToken(String token, HttpServletRequest request) {
|
|
|
+ public R loginByToken(String token, String gfzxToken, HttpServletRequest request) {
|
|
|
String sys_isonline = ParamCache.getValue(CommonConstant.SYS_ISONLINE);
|
|
|
token = "bearer " + token;
|
|
|
HttpClient httpClient = HttpClientBuilder.create().build();
|
|
@@ -815,4 +817,51 @@ public class UserController {
|
|
|
}
|
|
|
return this.getLoginInfo(Authorization,userInfo);
|
|
|
}
|
|
|
+
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 成渝获取token接口
|
|
|
+ *
|
|
|
+ * @param request
|
|
|
+ * @return
|
|
|
+ */
|
|
|
+ @PostMapping("/loginByToken5")
|
|
|
+ public R loginByToken5(String token, HttpServletRequest request) {
|
|
|
+ if (token == null) {
|
|
|
+ return R.fail("token值不能为空");
|
|
|
+ }
|
|
|
+ //获取公钥 存放在系统配置中
|
|
|
+ String sql = "select param_value from blade_param where param_key = 'gfzx.publicKey' and is_deleted = 0";
|
|
|
+ String publicKey = jdbcTemplate.queryForObject(sql, String.class);
|
|
|
+ if (StringUtil.isBlank(publicKey)) {
|
|
|
+ return R.fail("系统中不存在公钥信息,请联系管理员");
|
|
|
+ }
|
|
|
+ //解密
|
|
|
+ TokenVerifyResult tokenVerifyResult = RSA256Utils.verifyToken(token, publicKey);
|
|
|
+ if(!tokenVerifyResult.isValid()){
|
|
|
+ return R.fail(tokenVerifyResult.getMessage());
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+ QueryWrapper<User> queryWrapper = new QueryWrapper<>();
|
|
|
+ queryWrapper.eq("account", tokenVerifyResult.getAccount());
|
|
|
+ queryWrapper.eq("sys_type", 2);
|
|
|
+ User userInfo = userService.getOne(queryWrapper);
|
|
|
+ if (userInfo == null) {
|
|
|
+ return R.fail("用户名或密码错误");
|
|
|
+ }
|
|
|
+
|
|
|
+ String Authorization = request.getHeader("Authorization");
|
|
|
+
|
|
|
+ if (Authorization == null || StringUtil.isEmpty(Authorization)) {
|
|
|
+ String dataInfo = "archives:archives_secret";
|
|
|
+ Authorization = "Basic " + Func.encodeBase64(dataInfo);
|
|
|
+ R loginInfo = this.getLoginInfo(Authorization, userInfo);
|
|
|
+ if (loginInfo.getCode() == 200) {
|
|
|
+ return loginInfo;
|
|
|
+ }
|
|
|
+ }
|
|
|
+ return this.getLoginInfo(Authorization, userInfo);
|
|
|
+ }
|
|
|
}
|