Documentation ¶
Index ¶
- func JWT() func(echo.HandlerFunc) echo.HandlerFunc
- func JWTValidator(fl validator.FieldLevel) bool
- func LimitValidator(fl validator.FieldLevel) bool
- func PasswordValidator(fl validator.FieldLevel) bool
- func Recaptcha() func(echo.HandlerFunc) echo.HandlerFunc
- func Struct(c *echo.Context, b interface{}) (err error)
- func TestingValidator(fl validator.FieldLevel) bool
- type CustomValidator
- type RecaptchaResponse
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func JWT ¶
func JWT() func(echo.HandlerFunc) echo.HandlerFunc
JWT middleware checks the user role is authorized to query the route
func JWTValidator ¶
func JWTValidator(fl validator.FieldLevel) bool
JWTValidator validates that the field contains a valid jwt token
func LimitValidator ¶
func LimitValidator(fl validator.FieldLevel) bool
LimitValidator to test custom validators
func PasswordValidator ¶
func PasswordValidator(fl validator.FieldLevel) bool
PasswordValidator to test custom validators
func Recaptcha ¶
func Recaptcha() func(echo.HandlerFunc) echo.HandlerFunc
Recaptcha middleware to validate recaptcha input
func Struct ¶
func Struct(c *echo.Context, b interface{}) (err error)
Struct this is not a middleware, but I would like it to be
func TestingValidator ¶
func TestingValidator(fl validator.FieldLevel) bool
TestingValidator to test custom validators
Types ¶
type CustomValidator ¶
type CustomValidator struct {
// contains filtered or unexported fields
}
CustomValidator wrapper for validator
func NewValidator ¶
func NewValidator() *CustomValidator
NewValidator returns new validator instance
func (*CustomValidator) RegisterCustomValidations ¶
func (cv *CustomValidator) RegisterCustomValidations()
RegisterCustomValidations enhance the validator with a set of custom validators
func (*CustomValidator) Validate ¶
func (cv *CustomValidator) Validate(i interface{}) (err error)
Validate apply validation on passed interface
func (*CustomValidator) Var ¶
func (cv *CustomValidator) Var(i interface{}, tag string) (err error)
Var apply validation on passed variable
type RecaptchaResponse ¶
type RecaptchaResponse struct { Success bool `json:"success"` ChallengeTs time.Time `json:"Challenge_ts,omitempty"` // timestamp of the challenge load (ISO format yyyy-MM-dd'T'HH:mm:ssZZ) Hostname string `json:"hostname,omitempty"` // the hostname of the site where the reCAPTCHA was solved ApkPackageName string `json:"apk_package_name,omitempty"` ErrorCodes []string `json:"error_codes,omitempty"` // optional }
RecaptchaResponse Google Recaptcha API response