Documentation
¶
Overview ¶
Package google provides integrations with Google services: OAuth2 token handling and reCAPTCHA verification.
Index ¶
Constants ¶
View Source
const ( ErrCodeCaptchaNotSupportedVer = "CPT-001" ErrCodeCaptchaRequest = "CPT-002" ErrCodeCaptchaResponseFormat = "CPT-003" ErrCodeCaptchaResponseStatus = "CPT-004" )
View Source
const ( ErrCodeOAuthConfigRead = "OAUTH-001" ErrCodeOAuthService = "OAUTH-002" ErrCodeOAuthGetUser = "OAUTH-003" ErrCodeOAuthConfigFileRead = "OAUTH-004" )
Variables ¶
View Source
var ( ErrCaptchaNotSupportedVer = func(ctx context.Context) error { return jet.NewAppErrBuilder(ErrCodeCaptchaNotSupportedVer, "not supported version").C(ctx).Business().Err() } ErrCaptchaRequest = func(ctx context.Context, err error) error { return jet.NewAppErrBuilder(ErrCodeCaptchaRequest, "request error").Wrap(err).C(ctx).Err() } ErrCaptchaResponseFormat = func(ctx context.Context, err error) error { return jet.NewAppErrBuilder(ErrCodeCaptchaResponseFormat, "response format").Wrap(err).C(ctx).Err() } ErrCaptchaResponseStatus = func(ctx context.Context, status string) error { return jet.NewAppErrBuilder(ErrCodeCaptchaResponseStatus, "response status: %s", status).C(ctx).Err() } )
View Source
var ( ErrOAuthConfigRead = func(ctx context.Context, cause error) error { return jet.NewAppErrBuilder(ErrCodeOAuthConfigRead, "reading config").Wrap(cause).C(ctx).Business().Err() } ErrOAuthService = func(ctx context.Context, cause error) error { return jet.NewAppErrBuilder(ErrCodeOAuthService, "service").Wrap(cause).C(ctx).Business().Err() } ErrOAuthGetUser = func(ctx context.Context, cause error) error { return jet.NewAppErrBuilder(ErrCodeOAuthGetUser, "get user").Wrap(cause).C(ctx).Business().Err() } ErrOAuthConfigFileRead = func(ctx context.Context, cause error) error { return jet.NewAppErrBuilder(ErrCodeOAuthConfigFileRead, "reading config").Wrap(cause).C(ctx).Business().Err() } )
Functions ¶
This section is empty.
Types ¶
type Captcha ¶
type Captcha interface {
// Verify captcha
Verify(ctx context.Context, rq *CaptchaRequest) (bool, error)
}
type CaptchaRequest ¶
type Config ¶
type Config struct {
ConfigurationPath string `mapstructure:"configuration_path"`
JsonConfiguration string `mapstructure:"json_configuration"`
ClientTimeout int `mapstructure:"client_timeout"`
ReCaptchaSecretV2 string `mapstructure:"recaptcha_secret_v2"`
ReCaptchaSecretV3 string `mapstructure:"recaptcha_secret_v3"`
ReCaptchaScore float64 `mapstructure:"recaptcha_score"`
}
Click to show internal directories.
Click to hide internal directories.