|
@@ -16,6 +16,7 @@ import com.ruoyi.system.domain.dto.SysSecretProjectDTO;
|
|
|
import com.ruoyi.system.mapper.SysProjectMapper;
|
|
|
import com.ruoyi.system.mapper.SysSecretProjectMapper;
|
|
|
import com.ruoyi.system.service.ISysProjectService;
|
|
|
+import com.ruoyi.web.controller.sm4.SM4Utils;
|
|
|
import com.ruoyi.web.utils.ClipboardUtil;
|
|
|
import com.ruoyi.web.utils.JWTExample;
|
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
@@ -113,23 +114,21 @@ public class SysSecretProjectController extends BaseController {
|
|
|
|
|
|
@PostMapping("/authority")
|
|
|
public R authority(@RequestBody JSONObject json) throws ParseException {
|
|
|
+ SM4Utils sm4 = new SM4Utils();
|
|
|
Map map = new HashMap<>();
|
|
|
SimpleDateFormat dateFormat = new SimpleDateFormat("yyyy-MM-dd");
|
|
|
// 验证和解析JWT
|
|
|
- String secretKey = json.get("secretKey").toString();
|
|
|
+ String secretKey = sm4.decryptData_CBC(json.get("secretKey").toString());
|
|
|
// TODO: 2023/11/23 解密 secretKey
|
|
|
if (JWTExample.validateJWT(secretKey)) {
|
|
|
- String str = JWTExample.parseJWT(json.get("secretKey").toString());
|
|
|
SysSecretProject sysSecretProject = sysSecretProjectMapper.selectBaseBySecretKey(secretKey);
|
|
|
Date now = new Date();
|
|
|
Date date = dateFormat.parse(sysSecretProject.getOverdueDate().toString());
|
|
|
long seconds = (date.getTime() - now.getTime()) / 1000;
|
|
|
map.put("overdueDate", seconds);
|
|
|
map.put("isOverdue", true);
|
|
|
-// System.out.println("解析到的项目名称:" + str);
|
|
|
} else {
|
|
|
map.put("isOverdue", false);
|
|
|
- System.out.println("JWT验证失败");
|
|
|
}
|
|
|
return R.ok(map);
|
|
|
}
|