From 9b3da964c23a31f9d1164b74b5742d1034de8af3 Mon Sep 17 00:00:00 2001
From: jiangping <jp@doumee.com>
Date: 星期四, 09 五月 2024 17:09:53 +0800
Subject: [PATCH] 最新版本
---
server/system_gateway/src/main/java/com/doumee/api/gateway/JwtAuthController.java | 31 ++++++++++++++++++++++++++++++-
1 files changed, 30 insertions(+), 1 deletions(-)
diff --git a/server/system_gateway/src/main/java/com/doumee/api/gateway/JwtAuthController.java b/server/system_gateway/src/main/java/com/doumee/api/gateway/JwtAuthController.java
index 2cbb365..7d06475 100644
--- a/server/system_gateway/src/main/java/com/doumee/api/gateway/JwtAuthController.java
+++ b/server/system_gateway/src/main/java/com/doumee/api/gateway/JwtAuthController.java
@@ -10,6 +10,7 @@
import com.doumee.core.model.LoginUserInfo;
import com.doumee.core.utils.Constants;
import com.doumee.dao.system.dto.LoginDTO;
+import com.doumee.service.common.CaptchaService;
import com.doumee.service.system.SystemLoginService;
import com.doumee.service.system.SystemUserService;
import io.swagger.annotations.Api;
@@ -39,6 +40,18 @@
@Autowired
private SystemLoginService systemLoginService;
+ @Autowired
+ private CaptchaService captchaService;
+
+ /**
+ * @author Eva.Caesar Liu
+ * @date 2023/03/21 14:49
+ */
+ @ApiOperation("鑾峰彇鍥剧墖楠岃瘉鐮�")
+ @GetMapping("/captcha")
+ public ApiResponse<CaptchaService.Captcha> getCaptcha() {
+ return ApiResponse.success(captchaService.genCaptcha());
+ }
@PreventRepeat(limit = 10, lockTime = 10000)
@ApiOperation("鐧诲綍")
@@ -63,7 +76,7 @@
*/
@PostMapping("/refreshtoken")
@ApiOperation("鍒锋柊token")
- public ApiResponse<String> refreshtoken(@RequestHeader("userToken") String oldToken){
+ public ApiResponse<String> refreshtoken(@RequestHeader(Constants.HEADER_USER_TOKEN) String oldToken){
try {
if(!jwtTokenUtil.isTokenExpired(oldToken)){
return ApiResponse.success(jwtTokenUtil.refreshToken(oldToken));
@@ -76,6 +89,22 @@
}
}
+ /**
+ * 鍒锋柊JWT浠ょ墝,鐢ㄦ棫鐨勪护鐗屾崲鏂扮殑浠ょ墝
+ */
+ @PostMapping("/logout")
+ @ApiOperation("閫�鍑虹櫥闄�")
+ public ApiResponse<String> logout(@RequestHeader(Constants.HEADER_USER_TOKEN) String oldToken){
+ try {
+ jwtTokenUtil.logout(oldToken);
+ }catch (BusinessException e){
+ return ApiResponse.failed(e.getCode(),e.getMessage());
+ }catch (Exception e){
+ return ApiResponse.failed(ResponseStatus.SERVER_ERROR);
+ }
+ return ApiResponse.success(null);
+
+ }
/**
* 鍒锋柊JWT浠ょ墝,鐢ㄦ棫鐨勪护鐗屾崲鏂扮殑浠ょ墝
--
Gitblit v1.9.3