feat(sso): 新增获取图形验证码接口
在 VerifyController 中添加 /captcha 接口,用于获取图形验证码。 Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
parent
1b8168ba10
commit
122692bc8b
@ -10,6 +10,8 @@ import org.springframework.web.bind.annotation.PostMapping;
|
|||||||
import org.springframework.web.bind.annotation.RequestMapping;
|
import org.springframework.web.bind.annotation.RequestMapping;
|
||||||
import org.springframework.web.bind.annotation.RestController;
|
import org.springframework.web.bind.annotation.RestController;
|
||||||
|
|
||||||
|
import java.util.Map;
|
||||||
|
|
||||||
import javax.annotation.Resource;
|
import javax.annotation.Resource;
|
||||||
import javax.annotation.security.PermitAll;
|
import javax.annotation.security.PermitAll;
|
||||||
import javax.servlet.http.HttpServletRequest;
|
import javax.servlet.http.HttpServletRequest;
|
||||||
@ -31,6 +33,14 @@ public class VerifyController {
|
|||||||
return verifyService.getVerifyToken(remoteId);
|
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) {
|
public static String getRemoteId(HttpServletRequest request) {
|
||||||
String ip = ServletUtils.getClientIP(request);
|
String ip = ServletUtils.getClientIP(request);
|
||||||
String ua = request.getHeader("user-agent");
|
String ua = request.getHeader("user-agent");
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user