http

package
v1.1.5 Latest Latest
Warning

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

Go to latest
Published: Dec 12, 2025 License: Apache-2.0 Imports: 22 Imported by: 0

Documentation

Index

Constants

View Source
const (
	HeaderAuthorization = "authorization"
	HeaderCacheControl  = "cache-control"
	HeaderContentType   = "content-type"
	HeaderCookie        = "cookie"
	HeaderLocation      = "location"
	HeaderPragma        = "pragma"
	HeaderSetCookie     = "set-cookie"

	HeaderCacheControlNoCache = "no-cache"

	HeaderContentTypeFormURLEncoded = "application/x-www-form-urlencoded"

	HeaderPragmaNoCache = "no-cache"

	HeaderSetCookieSecure         = "Secure"
	HeaderSetCookieHTTPOnly       = "HttpOnly"
	HeaderSetCookieSameSiteStrict = "SameSite=Strict"
	HeaderSetCookieSameSiteLax    = "SameSite=Lax"
	HeaderSetCookieSameSiteNone   = "SameSite=None"
	HeaderSetCookieMaxAge         = "Max-Age"
	HeaderSetCookiePartitioned    = "Partitioned"
)

Variables

This section is empty.

Functions

func BasicAuthHeader

func BasicAuthHeader(id string, secret string) string

BasicAuthHeader returns the value of the Authorization header for the given id and secret.

func BearerAuthHeader added in v1.1.0

func BearerAuthHeader(token string) string

BearerAuthHeader returns the value of the Authorization header for the given token.

func DecodeCookiesHeader

func DecodeCookiesHeader(headerValue string) map[string]string

DecodeCookiesHeader parses the value of the Cookie header to find all the cookies set. It returns a map of name->value for all the found valid cookies.

func EncodeCookieHeader

func EncodeCookieHeader(name string, value string, directives []string) string

EncodeCookieHeader builds the value of the Set-Cookie header from the given cookie name, value and directives.

func GetPathQueryFragment

func GetPathQueryFragment(fullPath string) (path string, query string, fragment string)

GetPathQueryFragment splits the given path into path, query, and fragment. See https://tools.ietf.org/html/rfc3986#section-3.4 and https://tools.ietf.org/html/rfc3986#section-3.5 for more information.

func NewHTTPClient added in v1.0.1

func NewHTTPClient(cfg *oidcv1.OIDCConfig, tlsPool TLSConfigPool, log telemetry.Logger) (*http.Client, error)

NewHTTPClient creates a new HTTP client with the given OIDC configuration and TLS pool. If a logger is provided, it will log the requests and responses at debug level.

func StatusToGrpcCode added in v1.1.0

func StatusToGrpcCode(code int) codes.Code

StatusToGrpcCode returns the gRPC code for the given HTTP response status. See: https://github.com/googleapis/googleapis/blob/master/google/rpc/code.proto

Types

type LoggingRoundTripper added in v1.0.1

type LoggingRoundTripper struct {
	Log      telemetry.Logger
	Delegate http.RoundTripper
}

LoggingRoundTripper is a http.RoundTripper that logs requests and responses.

func (LoggingRoundTripper) RoundTrip added in v1.0.1

func (l LoggingRoundTripper) RoundTrip(req *http.Request) (*http.Response, error)

RoundTrip logs all the requests and responses using the configured settings.

type TLSConfig added in v1.1.0

type TLSConfig interface {
	// GetTrustedCertificateAuthority returns the trusted certificate authority PEM.
	GetTrustedCertificateAuthority() string
	// GetTrustedCertificateAuthorityFile returns the path to the trusted certificate authority file.
	GetTrustedCertificateAuthorityFile() string
	// GetSkipVerifyPeerCert returns whether to skip verification of the peer certificate.
	GetSkipVerifyPeerCert() *structpb.Value
	// GetTrustedCertificateAuthorityRefreshInterval returns interval at which the trusted certificate
	// authority should be refreshed.
	GetTrustedCertificateAuthorityRefreshInterval() *durationpb.Duration
}

TLSConfig is an interface for the TLS configuration of the AuthService.

type TLSConfigPool added in v1.1.0

type TLSConfigPool interface {
	// LoadTLSConfig loads a TLS configuration from the given TLSConfig.
	LoadTLSConfig(config TLSConfig) (*tls.Config, error)
}

TLSConfigPool is an interface for a pool of TLS configurations.

func NewTLSConfigPool added in v1.1.0

func NewTLSConfigPool(fileWatcher watch.Callbacker) TLSConfigPool

NewTLSConfigPool creates a new TLSConfigPool.

Jump to

Keyboard shortcuts

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