Versions in this module Expand all Collapse all v0 v0.0.1 Aug 8, 2023 Changes in this version + const ContextKeyHeaderAllow + const ExtractorMethodCookie + const ExtractorMethodForm + const ExtractorMethodHeader + const ExtractorMethodParam + const ExtractorMethodQuery + var CSRFContextKey = "csrf" + var ErrCSRFInvalid = xerror.NewHTTPError(http.StatusForbidden, "invalid csrf token") + var ErrCookieExtractorValueMissing = errors.New("missing value in cookies") + var ErrFormExtractorValueMissing = errors.New("missing value in the form") + var ErrHeaderExtractorValueInvalid = errors.New("invalid value in request header") + var ErrHeaderExtractorValueMissing = errors.New("missing value in request header") + var ErrParamExtractorValueMissing = errors.New("missing value in path params") + var ErrQueryExtractorValueMissing = errors.New("missing value in the query string") + func BasicAuthNext(fn BasicAuthValidator) gin.HandlerFunc + func BasicAuthNextWithConfig(config BasicAuthConfig) gin.HandlerFunc + func CORSForceNext(inputExposeHeaders ...string) gin.HandlerFunc + func CORSNext() gin.HandlerFunc + func CORSNextWithConfig(config CORSConfig) gin.HandlerFunc + func CSRFFormHTML(c *gin.Context, inputTypes ...string) template.HTML + func CSRFNext() gin.HandlerFunc + func CSRFNextWithConfig(config CSRFConfig) gin.HandlerFunc + func DefaultErrorHandler(c *gin.Context, err error, statusCodes ...int) + func DefaultSkipper(ctx *gin.Context) bool + func ErrorsNext(errorHandlers ...ErrorHandler) gin.HandlerFunc + func GzipNext() gin.HandlerFunc + func GzipNextWithConfig(config GzipConfig) gin.HandlerFunc + func KeyAuthNext(fn KeyAuthValidator) gin.HandlerFunc + func KeyAuthNextWithConfig(config KeyAuthConfig) gin.HandlerFunc + func MatchScheme(domain, pattern string) bool + func MatchSubdomain(domain, pattern string) bool + func RequestIdNext() gin.HandlerFunc + func RequestIdNextWithConfig(config RequestIDConfig) gin.HandlerFunc + func SecureNext() gin.HandlerFunc + func SecureNextWithConfig(config SecureConfig) gin.HandlerFunc + type BasicAuthConfig struct + Realm string + Skipper Skipper + Validator BasicAuthValidator + type BasicAuthValidator func(s1, s2 string, c *gin.Context) bool + type CORSConfig struct + AllowCredentials bool + AllowHeaders []string + AllowMethods []string + AllowOriginFunc func(origin string) (bool, error) + AllowOrigins []string + ErrorHandler ErrorHandler + ExposeHeaders []string + MaxAge int + Skipper Skipper + UnsafeWildcardOriginWithAllowCredentials bool + type CSRFConfig struct + ContextKey string + CookieDomain string + CookieHTTPOnly bool + CookieMaxAge int + CookieName string + CookiePath string + CookieSameSite http.SameSite + CookieSecure bool + ErrorHandler ErrorHandler + Skipper Skipper + TokenLength int + TokenLookup string + type ErrKeyAuthMissing struct + Err error + func (e *ErrKeyAuthMissing) Error() string + func (e *ErrKeyAuthMissing) Unwrap() error + type ErrorHandler func(c *gin.Context, err error, statusCodes ...int) + type GzipConfig struct + Level int + Skipper Skipper + type KeyAuthConfig struct + AuthScheme string + ContinueOnIgnoredError bool + ErrorHandler ErrorHandler + KeyLookup string + Skipper Skipper + Validator KeyAuthValidator + type KeyAuthValidator func(auth string, c *gin.Context) (bool, error) + type RequestIDConfig struct + Generator func() string + RequestIDHandler func(*gin.Context, string) + Skipper Skipper + TargetHeader string + type SecureConfig struct + CSPReportOnly bool + ContentSecurityPolicy string + ContentTypeNosniff string + HSTSExcludeSubdomains bool + HSTSMaxAge int + HSTSPreloadEnabled bool + ReferrerPolicy string + Skipper Skipper + XFrameOptions string + XSSProtection string + type Skipper func(c *gin.Context) bool + type SuccessHandler func(c *gin.Context) + type ValuesExtractor func(c *gin.Context) ([]string, error) + func CreateExtractors(lookups string, authScheme string) ([]ValuesExtractor, error)