feat(sso): 新增获取图形验证码接口

在 VerifyController 中添加 /captcha 接口,用于获取图形验证码。

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
liulujian 2026-04-15 15:36:08 +08:00
parent 1b8168ba10
commit 122692bc8b

View File

@ -10,6 +10,8 @@ import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import java.util.Map;
import javax.annotation.Resource;
import javax.annotation.security.PermitAll;
import javax.servlet.http.HttpServletRequest;
@ -31,6 +33,14 @@ public class VerifyController {
return verifyService.getVerifyToken(remoteId);
}
@Operation(summary = "获取图形验证码")
@PermitAll
@PostMapping("/captcha")
public CommonResult<Map<String, String>> getCaptcha(HttpServletRequest request) {
final String remoteId = getRemoteId(request);
return verifyService.getCaptcha(remoteId);
}
public static String getRemoteId(HttpServletRequest request) {
String ip = ServletUtils.getClientIP(request);
String ua = request.getHeader("user-agent");