Commit cf3ad0e9 authored by 赵啸非's avatar 赵啸非

添加门户license验证

parent fc7baa17
......@@ -25,9 +25,9 @@ import java.rmi.RemoteException;
* @author: zxfei
* @date: 2024/7/9 13:49
*/
@Component
//@Component
@Slf4j
@ConditionalOnProperty(prefix = "license",name = "enable", havingValue = "true")
//@ConditionalOnProperty(prefix = "license",name = "enable", havingValue = "true")
public class LicenseInterceptor extends BaseInterceptor {
@Resource
......
......@@ -3,7 +3,9 @@ package com.mortals.xhx.module.cipher.web;
import cn.hutool.core.date.DateUtil;
import com.github.xiaoymin.knife4j.annotations.ApiOperationSupport;
import com.mortals.framework.annotation.UnAuth;
import com.mortals.framework.common.Rest;
import com.mortals.xhx.base.framework.config.LicenseHandler;
import com.mortals.xhx.common.utils.CipherUtil;
import com.mortals.xhx.common.utils.DecodeUtil;
import com.mortals.xhx.common.utils.LicenseUtil;
......@@ -15,6 +17,7 @@ import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import javax.annotation.Resource;
import java.util.HashMap;
import java.util.Map;
......@@ -36,7 +39,6 @@ public class CipherController {
@Value("${sys.license.pub}")
private String pubPath;
/**
* 用户在点击,查看`授权信息`按钮时,请求check接口,进行一次授权验证(每天第一次通过其他接口访问系统时,也会验证一次 )
* 如果通过则返回授权信息(开始+结束时间)
......@@ -45,6 +47,7 @@ public class CipherController {
* @return
*/
@GetMapping("/check")
@UnAuth
public Rest<Map<String, String>> check() {
// 验证是否通过了授权,通过了返回授权信息(开始+结束时间)
try {
......@@ -66,8 +69,8 @@ public class CipherController {
return Rest.ok(resultMap);
} catch (Exception e) {
log.error(e.getMessage(), e);
return Rest.fail("获取授权信息失败");
log.error("检测授权异常", e);
return Rest.fail(e.getMessage());
}
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment