Documentation ¶
Index ¶
Constants ¶
View Source
const (
DefaultProviderName = "captcha"
)
Variables ¶
View Source
var ( ErrCaptchaFailed = errors.New("captcha failed") ErrCaptchaRequired = errors.New("captcha required") )
Functions ¶
Types ¶
type AccpClaimsExample ¶
type AccpClaimsExample struct { *jwt.StandardClaims TokenType string }
type Config ¶
type Config struct { // JWT token TTL TokenTTL time.Duration // JWT token sign TokenSign string // Google verify URL VerifyURL string // Google captcha secret key Key string // Header is name of header in request for captcha Header helper.Arguments // Cookie is name of cookie in request for captcha Cookie helper.Arguments // Pool is config for http clients pool Pool *httpclient.Config }
Config is config structure for captcha
func (*Config) SetDefault ¶
func (c *Config) SetDefault()
type GoogleCaptcha ¶
type GoogleCaptcha struct {
// contains filtered or unexported fields
}
func Get ¶
func Get(ctx context.Context) *GoogleCaptcha
func NewGoogleCaptcha ¶
func NewGoogleCaptcha(ctx context.Context, cfg *Config) (*GoogleCaptcha, error)
func (*GoogleCaptcha) GenerateCaptchaJWT ¶
func (g *GoogleCaptcha) GenerateCaptchaJWT(w http.ResponseWriter) error
func (*GoogleCaptcha) Validate ¶
func (g *GoogleCaptcha) Validate(r *http.Request) (SrcCaptcha, error)
type GoogleRecaptchaResponse ¶
type SrcCaptcha ¶
type SrcCaptcha int
const ( CaptchaSrcUnknown SrcCaptcha = iota CaptchaFromClient CaptchaFromGoogle )
Click to show internal directories.
Click to hide internal directories.