Documentation ¶
Index ¶
- Constants
- Variables
- func AssetsCacheInterceptor(maxAge, sharedMaxAge time.Duration, h http.Handler) http.Handler
- func CORSInterceptor(h http.Handler) http.Handler
- func CORSInterceptorOpts(opts cors.Options, h http.Handler) http.Handler
- func CacheInterceptorOpts(h http.Handler, cache *Cache) http.Handler
- func DefaultCacheInterceptor(pattern string, maxAge, sharedMaxAge time.Duration) (func(http.Handler) http.Handler, error)
- func DefaultMetricsHandler(handler http.Handler) http.Handler
- func DefaultTelemetryHandler(handler http.Handler) http.Handler
- func GetNonce(r *http.Request) string
- func MetricsHandler(metricTypes []metrics.MetricType, ignoredMethods ...string) func(http.Handler) http.Handler
- func NewUserAgentHandler(config *UserAgentCookieConfig, idGenerator id.Generator, localDevMode bool) (func(http.Handler) http.Handler, error)
- func NoCacheInterceptor(h http.Handler) http.Handler
- func SecurityHeaders(csp *CSP, errorHandler func(error) http.Handler, nonceLength ...uint) func(http.Handler) http.Handler
- func TelemetryHandler(ignoredMethods ...string) func(http.Handler) http.Handler
- func UserAgentIDFromCtx(ctx context.Context) (string, bool)
- type AuthInterceptor
- type CSP
- type CSPSourceOptions
- func (srcOpts CSPSourceOptions) AddEval() CSPSourceOptions
- func (srcOpts CSPSourceOptions) AddHash(alg, b64v string) CSPSourceOptions
- func (srcOpts CSPSourceOptions) AddHost(h ...string) CSPSourceOptions
- func (srcOpts CSPSourceOptions) AddInline() CSPSourceOptions
- func (srcOpts CSPSourceOptions) AddNonce() CSPSourceOptions
- func (srcOpts CSPSourceOptions) AddScheme(s ...string) CSPSourceOptions
- func (srcOpts CSPSourceOptions) AddSelf() CSPSourceOptions
- func (srcOpts CSPSourceOptions) AddStrictDynamic() CSPSourceOptions
- func (srcOpts CSPSourceOptions) String(nonce string) string
- type Cache
- type CacheConfig
- type Cacheability
- type Revalidation
- type UserAgent
- type UserAgentCookieConfig
Constants ¶
View Source
const ( CacheabilityNotSet Cacheability = "" CacheabilityPublic = "public" CacheabilityPrivate = "private" )
View Source
const ( RevalidationNotSet Revalidation = "" RevalidationMust = "must-revalidate" RevalidationProxy = "proxy-revalidate" )
View Source
const (
DefaultNonceLength = uint(32)
)
Variables ¶
View Source
var ( NeverCacheOptions = &Cache{ NoStore: true, } AssetOptions = func(maxAge, SharedMaxAge time.Duration) *Cache { return &Cache{ Cacheability: CacheabilityPublic, MaxAge: maxAge, SharedMaxAge: SharedMaxAge, } } )
View Source
var ( DefaultCORSOptions = cors.Options{ AllowCredentials: true, AllowedHeaders: []string{ http_utils.Origin, http_utils.ContentType, http_utils.Accept, http_utils.AcceptLanguage, http_utils.Authorization, http_utils.ZitadelOrgID, http_utils.XUserAgent, http_utils.XGrpcWeb, }, AllowedMethods: []string{ http.MethodOptions, http.MethodGet, http.MethodHead, http.MethodPost, http.MethodPut, http.MethodPatch, http.MethodDelete, }, ExposedHeaders: []string{ http_utils.Location, http_utils.ContentLength, }, AllowOriginFunc: func(_ string) bool { return true }, } )
View Source
var ( DefaultSCP = CSP{ DefaultSrc: CSPSourceOptsNone(), ScriptSrc: CSPSourceOptsSelf(), ObjectSrc: CSPSourceOptsNone(), StyleSrc: CSPSourceOptsSelf(), ImgSrc: CSPSourceOptsSelf(), MediaSrc: CSPSourceOptsNone(), FrameSrc: CSPSourceOptsNone(), FontSrc: CSPSourceOptsSelf(), ManifestSrc: CSPSourceOptsSelf(), ConnectSrc: CSPSourceOptsSelf(), } )
Functions ¶
func AssetsCacheInterceptor ¶
func DefaultCacheInterceptor ¶
func MetricsHandler ¶
func NewUserAgentHandler ¶
func SecurityHeaders ¶
func TelemetryHandler ¶
Types ¶
type AuthInterceptor ¶
type AuthInterceptor struct {
// contains filtered or unexported fields
}
func AuthorizationInterceptor ¶
func AuthorizationInterceptor(verifier *authz.TokenVerifier, authConfig authz.Config) *AuthInterceptor
func (*AuthInterceptor) HandlerFunc ¶
func (a *AuthInterceptor) HandlerFunc(next http.HandlerFunc) http.HandlerFunc
type CSP ¶
type CSP struct { DefaultSrc CSPSourceOptions ScriptSrc CSPSourceOptions ObjectSrc CSPSourceOptions StyleSrc CSPSourceOptions ImgSrc CSPSourceOptions MediaSrc CSPSourceOptions FrameSrc CSPSourceOptions FontSrc CSPSourceOptions ManifestSrc CSPSourceOptions ConnectSrc CSPSourceOptions FormAction CSPSourceOptions }
type CSPSourceOptions ¶
type CSPSourceOptions []string
func CSPSourceOpts ¶
func CSPSourceOpts() CSPSourceOptions
func CSPSourceOptsNone ¶
func CSPSourceOptsNone() CSPSourceOptions
func CSPSourceOptsSelf ¶
func CSPSourceOptsSelf() CSPSourceOptions
func (CSPSourceOptions) AddEval ¶
func (srcOpts CSPSourceOptions) AddEval() CSPSourceOptions
func (CSPSourceOptions) AddHash ¶
func (srcOpts CSPSourceOptions) AddHash(alg, b64v string) CSPSourceOptions
func (CSPSourceOptions) AddHost ¶
func (srcOpts CSPSourceOptions) AddHost(h ...string) CSPSourceOptions
func (CSPSourceOptions) AddInline ¶
func (srcOpts CSPSourceOptions) AddInline() CSPSourceOptions
func (CSPSourceOptions) AddNonce ¶
func (srcOpts CSPSourceOptions) AddNonce() CSPSourceOptions
func (CSPSourceOptions) AddScheme ¶
func (srcOpts CSPSourceOptions) AddScheme(s ...string) CSPSourceOptions
func (CSPSourceOptions) AddSelf ¶
func (srcOpts CSPSourceOptions) AddSelf() CSPSourceOptions
func (CSPSourceOptions) AddStrictDynamic ¶
func (srcOpts CSPSourceOptions) AddStrictDynamic() CSPSourceOptions
func (CSPSourceOptions) String ¶
func (srcOpts CSPSourceOptions) String(nonce string) string
type Cache ¶
type Cache struct { Cacheability Cacheability NoCache bool NoStore bool MaxAge time.Duration NoTransform bool Revalidation Revalidation }
type CacheConfig ¶
type Cacheability ¶
type Cacheability string
type Revalidation ¶
type Revalidation string
Click to show internal directories.
Click to hide internal directories.