Documentation
¶
Index ¶
Constants ¶
const ImportPath = "github.com/cssbruno/gowdk/addons/actions"
ImportPath is the canonical Go import path for the actions addon.
Variables ¶
This section is empty.
Functions ¶
func DecodeForm ¶
DecodeForm parses request form data for generated typed action decoders.
func ValidateRequired ¶
func ValidateRequired(values form.Values, fields []string) validation.Result
ValidateRequired records one validation error for each missing required form field. Empty and whitespace-only submitted values are treated as missing.
Types ¶
type CSRF ¶
type CSRF struct {
// contains filtered or unexported fields
}
CSRF validates signed double-submit CSRF tokens for generated actions.
func NewCSRF ¶
func NewCSRF(options CSRFOptions) (*CSRF, error)
NewCSRF creates a validator with secure cookie defaults.
func (*CSRF) CookieName ¶ added in v0.1.5
CookieName returns the cookie name used for CSRF token storage.
func (*CSRF) FieldName ¶ added in v0.1.5
FieldName returns the form field name used for submitted CSRF tokens.
func (*CSRF) HeaderName ¶ added in v0.1.5
HeaderName returns the header name used for submitted CSRF tokens.
type CSRFOptions ¶
type CSRFOptions struct {
Secret []byte
CookieName string
FieldName string
HeaderName string
Insecure bool
SameSite http.SameSite
}
CSRFOptions configures signed double-submit CSRF tokens.
type CSRFTokenSource ¶ added in v0.1.5
type CSRFTokenSource interface {
Token(http.ResponseWriter, *http.Request) (string, error)
FieldName() string
}
CSRFTokenSource generates tokens for generated forms.
type CSRFValidator ¶
CSRFValidator validates action requests before generated handlers run.