极验验证目录
一、样例
二、注册账号
在表单里面填写真实信息,客服会在 24h 联系你进行审核,审核通过后,会发送这样的邮件到你的邮箱。
点击邮箱里面提供的注册地址即可完成注册。 注册成功后,进行登录:
三、获取ID
填写基本信息:
创建成功后:
点击 ID:
点击查看部署指引:
都勾选成功后,点击确认:
获取到了 ID 和 KEY:
记录 ID 和 KEY:
ID 上面获得到的id
KEY 上面获取到的value
- 1
- 2
四、极验官方文档(参考)
文档地址:
https://docs.geetest.com/sensebot/start/
服务端:
https://docs.geetest.com/sensebot/deploy/server/java#%E9%85%8D%E7%BD %AE%E5%AF%86%E9%92%A5
Web 端:
https://docs.geetest.com/sensebot/deploy/client/web
五、SpringBoot集成极验
5.1、maven依赖(可能有些需要自己去导,个人的包依赖太多不好全部放上来,核心就这两个)
<!--json的依赖-->
<dependency>
<groupId>org.json</groupId>
<artifactId>json</artifactId>
<version>20171018</version>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-data-redis</artifactId>
</dependency>
<dependency>
<groupId>org.projectlombok</groupId>
<artifactId>lombok</artifactId>
<version>1.18.12</version>
</dependency>
- 1
- 2
- 3
- 4
- 5
- 6
- 7
- 8
- 9
- 10
- 11
- 12
- 13
- 14
- 15
5.2、yml配置文件
spring:
redis:
host: redis-server #自己redis的ip,此处我做了ip映射
port: 6380
password: 123456
geetest:
geetest-id: 上面获得到的id
geetest-key: 上面获取到的value
- 1
- 2
- 3
- 4
- 5
- 6
- 7
- 8
5.3、util类(读本地ip)
package com.zhz.util;
import javax.servlet.http.HttpServletRequest;
/**
* 获取本地ip地址
*/
public class IpUtil {
public static String getIpAddr(HttpServletRequest request) {
String ip = request.getHeader("X-Forwarded-For");
if (ip == null || ip.length() == 0 || "unknown".equalsIgnoreCase(ip)) {
if (ip == null || ip.length() == 0 || "unknown".equalsIgnoreCase(ip)) {
ip = request.getHeader("Proxy-Client-IP");
}
if (ip == null || ip.length() == 0 || "unknown".equalsIgnoreCase(ip)) {
}
if (ip == null || ip.length() == 0 || "unknown".equalsIgnoreCase(ip)) {
ip = request.getHeader("HTTP_CLIENT_IP");
}
if (ip == null || ip.length() == 0 || "unknown".equalsIgnoreCase(ip)) {
ip = request.getHeader("HTTP_X_FORWARDED_FOR");
}
if (ip == null || ip.length() == 0 || "unknown".equalsIgnoreCase(ip)) {
ip = request.getHeader("HTTP_X_CONNECTING_IP");
}
if (ip == null || ip.length() == 0 || "unknown".equalsIgnoreCase(ip)) {
ip = request.getRemoteAddr();
}
} else if (ip.length() > 15) {
String[] ips = ip.split(",");
for (int index = 0; index < ips.length; index++) {
String strIp = (String) ips[index];
if (!("unknown".equalsIgnoreCase(strIp))) {
ip = strIp;