feat(security): 添加 Token 验证功能

- 在 CommonApi.js 中添加 validateToken 函数,用于验证 Token 有效性
- 在 HomePage.vue 中集成 Token 验证功能,导出前验证登录状态- 在 UserController.java 中添加 validateToken 接口,用于后端验证 Token
This commit is contained in:
ikmkj
2025-07-31 19:39:59 +08:00
parent 16998c5144
commit cd43768baf
3 changed files with 21 additions and 3 deletions

View File

@@ -11,6 +11,7 @@ import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.DeleteMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RestController;
import java.util.HashMap;
@@ -57,6 +58,10 @@ public class UserController {
return R.success("删除成功");
}
@Operation(summary = "验证Token有效性")
@PostMapping("/validate-token")
public R<String> validateToken() {
return R.success("Token is valid");
}
}