mirror of
https://github.com/maxlerebourg/crowdsec-bouncer-traefik-plugin.git
synced 2026-07-21 11:38:59 +02:00
🐛 fix bug with recaptcha (#141) and add doc for recaptcha
* 🐛 fix bug with recaptcha * 📝 Add documentation for recpatcha --------- Co-authored-by: max.lerebourg <max.lerebourg@monisnap.com> Co-authored-by: mhx <mathieu@hanotaux.fr>
This commit is contained in:
co-authored by
max.lerebourg
mhx
parent
497d1a2928
commit
6059f23dc3
@@ -144,3 +144,18 @@ sequenceDiagram
|
|||||||
PluginCache-->>TraefikPlugin: Yes a ban Decision
|
PluginCache-->>TraefikPlugin: Yes a ban Decision
|
||||||
TraefikPlugin->>User: No, HTTP 403
|
TraefikPlugin->>User: No, HTTP 403
|
||||||
```
|
```
|
||||||
|
|
||||||
|
## Captcha Configuration:
|
||||||
|
|
||||||
|
- Recaptcha
|
||||||
|
|
||||||
|
Choose v2 (challenge) and configure the domain to protect:
|
||||||
|

|
||||||
|
|
||||||
|
- Turnstile
|
||||||
|
|
||||||
|
TODO
|
||||||
|
|
||||||
|
- Hcatpcha
|
||||||
|
|
||||||
|
TODO
|
||||||
Binary file not shown.
|
After Width: | Height: | Size: 77 KiB |
@@ -8,6 +8,7 @@ import (
|
|||||||
"net/http"
|
"net/http"
|
||||||
"net/url"
|
"net/url"
|
||||||
"os"
|
"os"
|
||||||
|
"strings"
|
||||||
|
|
||||||
cache "github.com/maxlerebourg/crowdsec-bouncer-traefik-plugin/pkg/cache"
|
cache "github.com/maxlerebourg/crowdsec-bouncer-traefik-plugin/pkg/cache"
|
||||||
configuration "github.com/maxlerebourg/crowdsec-bouncer-traefik-plugin/pkg/configuration"
|
configuration "github.com/maxlerebourg/crowdsec-bouncer-traefik-plugin/pkg/configuration"
|
||||||
@@ -152,7 +153,8 @@ func (c *Client) Validate(r *http.Request) (bool, error) {
|
|||||||
c.log.Error(fmt.Sprintf("captcha:Validate %s", err.Error()))
|
c.log.Error(fmt.Sprintf("captcha:Validate %s", err.Error()))
|
||||||
}
|
}
|
||||||
}()
|
}()
|
||||||
if res.Header.Get("content-type") != "application/json" {
|
if !strings.Contains(res.Header.Get("content-type"), "application/json") {
|
||||||
|
c.log.Debug("captcha:Validate responseType:noJson")
|
||||||
return false, nil
|
return false, nil
|
||||||
}
|
}
|
||||||
var captchaResponse responseProvider
|
var captchaResponse responseProvider
|
||||||
|
|||||||
Reference in New Issue
Block a user