xfccparser

package module
v0.4.0 Latest Latest
Warning

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

Go to latest
Published: Oct 27, 2024 License: MIT Imports: 8 Imported by: 2 modules, 1 package

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

README

xfccparser: A parser for Envoy x-forwarded-client-cert

When Envoy terminates TLS, it sends along metadata about the client certificates in an x-forwarded-client-cert HTTP header. This library parses that header into Go structs.

Usage

var req *http.Request

xfccHeader := req.Header.Get(xfccparser.ForwardedClientCertHeader)
clientCerts, err := xfccparser.ParseXFCCHeader(xfccHeader)

Contributions

Thanks to Alec Thomas for help with the participle representation.

Documentation

Index

Constants

View Source
const (
	// ForwardedClientCertHeader is the name of the HTTP header Envoy uses to pass metadata about certificates presented by a client
	ForwardedClientCertHeader = "x-forwarded-client-cert"
)

Variables

This section is empty.

Functions

func ParseSubject

func ParseSubject(subject string) (*pkix.Name, error)

ParseSubject parses the subject string that is parse of the x-forwarded-client-cert header

Types

type ClientCert

type ClientCert struct {
	By         string
	Hash       string
	Cert       string
	Chain      string
	Subject    *pkix.Name
	SubjectRaw string
	URI        []string
	DNS        []string
}

ClientCert is a client certificate passed to Envoy

func ParseXFCCHeader

func ParseXFCCHeader(header string) ([]*ClientCert, error)

ParseXFCCHeader parses an x-forwarded-client-cert header and returns the list of certificates present. The format of the header is documented here: https://www.envoyproxy.io/docs/envoy/latest/configuration/http/http_conn_man/headers#x-forwarded-client-cert

Jump to

Keyboard shortcuts

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