util

package
v0.2.32 Latest Latest
Warning

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

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

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrClientCertificateNotPresent = errors.New("client certificate not presented")

	ErrClientCertificateError = errors.New("client certificate error")
)

Functions

func GetClientCertificate added in v0.2.30

func GetClientCertificate(in string) (*x509.Certificate, error)

GetClientCertificate retrieves the client certificate from headers injected by the ingress controller.

func GetClientCertificateHeader added in v0.2.30

func GetClientCertificateHeader(header http.Header) (string, error)

GetClientCertificateHeader extracts a client certificate from any present headers. TODO: may need to extract into a canonical form. NOTE: propagation at present expects this to be url encoded.

func GetClientCertiifcateThumbprint added in v0.2.30

func GetClientCertiifcateThumbprint(certificate *x509.Certificate) string

GetClientCertiifcateThumbprint returns the client certificate thumbprint as defined by RFC8705.

func ReadJSONBody

func ReadJSONBody(r *http.Request, v interface{}) error

ReadJSONBody is a generic request reader to unmarshal JSON bodies.

func WriteJSONResponse

func WriteJSONResponse(w http.ResponseWriter, r *http.Request, code int, response interface{})

WriteJSONResponse is a generic wrapper for returning a JSON payload to the client.

Types

This section is empty.

Jump to

Keyboard shortcuts

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