Documentation ¶
Index ¶
- Constants
- Variables
- func CopyHeadersToContext(h http.Handler) http.Handler
- func CreateListener(endpoint string) net.Listener
- func Endpoint(endpoint string) string
- func GetAuthorization(r *http.Request) string
- func GetForwardedFor(headers http.Header) (string, bool)
- func GetOrgID(r *http.Request) string
- func GetOriginFromURLString(s string) (string, error)
- func HeadersFromCtx(ctx context.Context) (http.Header, bool)
- func IsOrigin(rawOrigin string) bool
- func IsOriginAllowed(allowList []string, origin string) bool
- func MarshalJSON(w http.ResponseWriter, i interface{}, err error, statusCode int)
- func RegisterHandler(mux *http.ServeMux, prefix string, handler http.Handler)
- func RemoteAddrFromCtx(ctx context.Context) string
- func RemoteIPFromCtx(ctx context.Context) string
- func RemoteIPFromRequest(r *http.Request) net.IP
- func RemoteIPStringFromRequest(r *http.Request) string
- func Serve(ctx context.Context, handler http.Handler, port, servername string)
- func SetCookiePrefix(name, domain, path string, secureOnly bool) string
- func TokenUrl(domain, token string, checkType CheckType) (string, error)
- func ValidateDomain(domain, token, verifier string, checkType CheckType) error
- func ValidateDomainDNS(domain, verifier string) error
- func ValidateDomainHTTP(domain, token, verifier string) error
- type CheckType
- type CookieHandler
- func (c *CookieHandler) DeleteCookie(w http.ResponseWriter, name string)
- func (c *CookieHandler) GetCookieValue(r *http.Request, name string) (string, error)
- func (c *CookieHandler) GetEncryptedCookieValue(r *http.Request, name string, value interface{}) error
- func (c *CookieHandler) SetCookie(w http.ResponseWriter, name string, value string)
- func (c *CookieHandler) SetEncryptedCookie(w http.ResponseWriter, name string, value interface{}) error
- type CookieHandlerOpt
- func WithDomain(domain string) CookieHandlerOpt
- func WithEncryption(hashKey, encryptKey []byte) CookieHandlerOpt
- func WithMaxAge(maxAge int) CookieHandlerOpt
- func WithNonHttpOnly() CookieHandlerOpt
- func WithPath(path string) CookieHandlerOpt
- func WithSameSite(sameSite http.SameSite) CookieHandlerOpt
- func WithUnsecure() CookieHandlerOpt
- type Parser
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 ¶
View Source
var (
Probes = []string{Healthz, Readiness, Validation}
)
Functions ¶
func CreateListener ¶
func GetAuthorization ¶
func GetOriginFromURLString ¶
func IsOrigin ¶
IsOrigin checks if provided string is an origin (scheme://hostname[:port]) without path, query or fragment
func IsOriginAllowed ¶
func MarshalJSON ¶
func MarshalJSON(w http.ResponseWriter, i interface{}, err error, statusCode int)
func RegisterHandler ¶
func RemoteAddrFromCtx ¶
func RemoteIPFromCtx ¶
func SetCookiePrefix ¶
func ValidateDomain ¶
func ValidateDomainDNS ¶
func ValidateDomainHTTP ¶
Types ¶
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 (*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 ¶
func WithNonHttpOnly() CookieHandlerOpt
func WithPath ¶
func WithPath(path string) CookieHandlerOpt
func WithSameSite ¶
func WithSameSite(sameSite http.SameSite) CookieHandlerOpt
func WithUnsecure ¶
func WithUnsecure() CookieHandlerOpt
Source Files ¶
Click to show internal directories.
Click to hide internal directories.