增加“极验-行为验”验证码集成支持

This commit is contained in:
刘祥超
2023-11-29 16:58:24 +08:00
parent 7dbf5add34
commit a7336fafbf
6 changed files with 69 additions and 25 deletions

View File

@@ -10,6 +10,7 @@ const (
CaptchaTypeDefault CaptchaType = "default"
CaptchaTypeOneClick CaptchaType = "oneClick"
CaptchaTypeSlide CaptchaType = "slide"
CaptchaTypeGeeTest CaptchaType = "geetest"
)
// FindAllCaptchaTypes Find all captcha types
@@ -30,6 +31,11 @@ func FindAllCaptchaTypes() []*shared.Definition {
Name: "滑动解锁",
Description: "通过滑动方块解锁来验证人机。",
},
{
Code: CaptchaTypeGeeTest,
Name: "极验-行为验",
Description: "使用极验-行为验提供的人机验证方式。",
},
}
}

View File

@@ -1,5 +1,11 @@
package firewallconfigs
type GeeTestConfig struct {
IsOn bool `yaml:"isOn" json:"isOn"`
CaptchaId string `yaml:"captchaId" json:"captchaId"`
CaptchaKey string `yaml:"captchaKey" json:"captchaKey"`
}
type HTTPFirewallCaptchaAction struct {
IsPrior bool `yaml:"isPrior" json:"isPrior"`
@@ -10,6 +16,8 @@ type HTTPFirewallCaptchaAction struct {
FailBlockTimeout int `yaml:"failBlockTimeout" json:"failBlockTimeout"` // 失败拦截时间
FailBlockScopeAll bool `yaml:"failBlockScopeAll" json:"failBlockScopeAll"` // 是否全局有效
// 验证码相关配置
CountLetters int8 `yaml:"countLetters" json:"countLetters"` // 字符数量
UIIsOn bool `yaml:"uiIsOn" json:"uiIsOn"` // 是否使用自定义UI
@@ -24,6 +32,10 @@ type HTTPFirewallCaptchaAction struct {
CookieId string `yaml:"cookieId" json:"cookieId"` // TODO
Lang string `yaml:"lang" json:"lang"` // 语言zh-CN, en-US ... TODO 需要实现目前是根据浏览器Accept-Language动态获取
// 极验相关配置
// MUST be struct
GeeTestConfig GeeTestConfig `yaml:"geeTestConfig" json:"geeTestConfig"`
}
func DefaultHTTPFirewallCaptchaAction() *HTTPFirewallCaptchaAction {

View File

@@ -7,6 +7,7 @@ const (
ServerCaptchaTypeDefault ServerCaptchaType = CaptchaTypeDefault
ServerCaptchaTypeOneClick ServerCaptchaType = CaptchaTypeOneClick
ServerCaptchaTypeSlide ServerCaptchaType = CaptchaTypeSlide
ServerCaptchaTypeGeeTest ServerCaptchaType = CaptchaTypeGeeTest
)
type HTTPFirewallRef struct {