Documentation
¶
Overview ¶
Package club provides middleware for use in HTTP API servers and gateways.
Index ¶
Constants ¶
View Source
const (
RequestContextHeader = "x-amzn-request-context"
)
Variables ¶
This section is empty.
Functions ¶
func Bouncer ¶
Bouncer returns a HTTP Handler middleware function that adds the TLS client certificate from the request to the x-amzn-request-context header.
func Interceptor ¶
Interceptor is a HTTP handler middleware function that parses the x-amzn-request-context request header. The header is expected to contain a JSON encoded RequestContext. The identity namespace, client's UUID, and certificate are added to the request context.
Types ¶
type RequestContext ¶
type RequestContext struct {
Namespace uuid.UUID
ClientCertificate *x509.Certificate
ClientPublicKey *ecdsa.PublicKey
SourceIP string `json:"sourceIp"`
UserAgent string `json:"userAgent"`
}
func FromContext ¶ added in v1.4.0
func FromContext(ctx context.Context) (r *RequestContext, ok bool)
FromContext identifies a client from the request context. Interceptor must run before this function is called for a request.
func (RequestContext) MarshalJSON ¶ added in v1.7.0
func (r RequestContext) MarshalJSON() ([]byte, error)
func (*RequestContext) UnmarshalJSON ¶ added in v1.7.0
func (r *RequestContext) UnmarshalJSON(data []byte) error
Click to show internal directories.
Click to hide internal directories.