http

package
v1.42.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Sep 27, 2021 License: Apache-2.0 Imports: 13 Imported by: 0

Documentation

Index

Constants

View Source
const (
	CheckTypeHTTP CheckType = iota
	CheckTypeDNS

	HTTPPattern = "https://%s/.well-known/zitadel-challenge/%s"
	DNSPattern  = "_zitadel-challenge.%s"
)
View Source
const (
	Authorization   = "authorization"
	Accept          = "accept"
	AcceptLanguage  = "accept-language"
	CacheControl    = "cache-control"
	ContentType     = "content-type"
	ContentLength   = "content-length"
	Expires         = "expires"
	Location        = "location"
	Origin          = "origin"
	Pragma          = "pragma"
	UserAgentHeader = "user-agent"
	ForwardedFor    = "x-forwarded-for"
	XUserAgent      = "x-user-agent"
	XGrpcWeb        = "x-grpc-web"

	ContentSecurityPolicy   = "content-security-policy"
	XXSSProtection          = "x-xss-protection"
	StrictTransportSecurity = "strict-transport-security"
	XFrameOptions           = "x-frame-options"
	XContentTypeOptions     = "x-content-type-options"
	ReferrerPolicy          = "referrer-policy"
	FeaturePolicy           = "feature-policy"
	PermissionsPolicy       = "permissions-policy"

	ZitadelOrgID = "x-zitadel-orgid"
)
View Source
const (
	Healthz    = "/healthz"
	Readiness  = "/ready"
	Validation = "/validate"
)

Variables

Functions

func CopyHeadersToContext added in v0.20.0

func CopyHeadersToContext(h http.Handler) http.Handler

func CreateListener

func CreateListener(endpoint string) net.Listener

func Endpoint added in v0.52.0

func Endpoint(endpoint string) string

func GetAuthorization added in v1.12.0

func GetAuthorization(r *http.Request) string

func GetForwardedFor added in v0.52.0

func GetForwardedFor(headers http.Header) (string, bool)

func GetOrgID added in v1.12.0

func GetOrgID(r *http.Request) string

func GetOriginFromURLString added in v0.76.1

func GetOriginFromURLString(s string) (string, error)

func HeadersFromCtx added in v0.20.0

func HeadersFromCtx(ctx context.Context) (http.Header, bool)

func IsOrigin added in v1.7.0

func IsOrigin(rawOrigin string) bool

IsOrigin checks if provided string is an origin (scheme://hostname[:port]) without path, query or fragment

func IsOriginAllowed added in v0.76.1

func IsOriginAllowed(allowList []string, origin string) bool

func MarshalJSON added in v0.75.0

func MarshalJSON(w http.ResponseWriter, i interface{}, err error, statusCode int)

func RegisterHandler added in v0.52.0

func RegisterHandler(mux *http.ServeMux, prefix string, handler http.Handler)

func RemoteAddrFromCtx added in v0.20.0

func RemoteAddrFromCtx(ctx context.Context) string

func RemoteIPFromCtx added in v0.20.0

func RemoteIPFromCtx(ctx context.Context) string

func RemoteIPFromRequest added in v0.20.0

func RemoteIPFromRequest(r *http.Request) net.IP

func RemoteIPStringFromRequest added in v0.20.0

func RemoteIPStringFromRequest(r *http.Request) string

func Serve added in v0.52.0

func Serve(ctx context.Context, handler http.Handler, port, servername string)

func SetCookiePrefix added in v0.80.2

func SetCookiePrefix(name, domain, path string, secureOnly bool) string

func TokenUrl added in v0.69.0

func TokenUrl(domain, token string, checkType CheckType) (string, error)

func ValidateDomain added in v0.69.0

func ValidateDomain(domain, token, verifier string, checkType CheckType) error

func ValidateDomainDNS added in v0.69.0

func ValidateDomainDNS(domain, verifier string) error

func ValidateDomainHTTP added in v0.69.0

func ValidateDomainHTTP(domain, token, verifier string) error

Types

type CheckType added in v0.69.0

type CheckType int

type CookieHandler

type CookieHandler struct {
	// contains filtered or unexported fields
}

func NewCookieHandler

func NewCookieHandler(opts ...CookieHandlerOpt) *CookieHandler

func (*CookieHandler) DeleteCookie

func (c *CookieHandler) DeleteCookie(w http.ResponseWriter, name string)

func (*CookieHandler) GetCookieValue

func (c *CookieHandler) GetCookieValue(r *http.Request, name string) (string, error)

func (*CookieHandler) GetEncryptedCookieValue

func (c *CookieHandler) GetEncryptedCookieValue(r *http.Request, name string, value interface{}) error

func (*CookieHandler) SetCookie

func (c *CookieHandler) SetCookie(w http.ResponseWriter, name string, value string)

func (*CookieHandler) SetEncryptedCookie

func (c *CookieHandler) SetEncryptedCookie(w http.ResponseWriter, name string, value interface{}) error

type CookieHandlerOpt

type CookieHandlerOpt func(*CookieHandler)

func WithDomain

func WithDomain(domain string) CookieHandlerOpt

func WithEncryption

func WithEncryption(hashKey, encryptKey []byte) CookieHandlerOpt

func WithMaxAge

func WithMaxAge(maxAge int) CookieHandlerOpt

func WithNonHttpOnly added in v0.80.2

func WithNonHttpOnly() CookieHandlerOpt

func WithPath

func WithPath(path string) CookieHandlerOpt

func WithSameSite

func WithSameSite(sameSite http.SameSite) CookieHandlerOpt

func WithUnsecure

func WithUnsecure() CookieHandlerOpt

type Parser

type Parser struct {
	// contains filtered or unexported fields
}

func NewParser

func NewParser() *Parser

func (*Parser) Parse

func (p *Parser) Parse(r *http.Request, data interface{}) error

Directories

Path Synopsis

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL