test

package
v0.0.0-...-8521dca Latest Latest
Warning

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

Go to latest
Published: May 10, 2022 License: MIT Imports: 9 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func CertPoolFromChain

func CertPoolFromChain(certChain []*pem.Block) *x509.CertPool

func ParseX5CHeader

func ParseX5CHeader(x5c string) (signingCert *pem.Block, chain []*pem.Block, err error)

Types

type CATokenValidator

type CATokenValidator struct {
	RootCA []byte

	FallbackStaticPublicKey *x509.Certificate
}

func NewCATokenValidator

func NewCATokenValidator(rootCA []byte) *CATokenValidator

NewCATokenValidator takes a rootCA PEM to create a CATokenValidator instance

func NewCATokenValidatorWithFallbackCert

func NewCATokenValidatorWithFallbackCert(rootCA []byte, fallback []byte) (c *CATokenValidator, err error)

NewCATokenValidatorWithFallbackCert takes a rootCA PEM and a fallback certificate PEM to create a CATokenValidator instance

func (*CATokenValidator) Keyfunc

func (c *CATokenValidator) Keyfunc(token *jwt.Token) (interface{}, error)

Keyfunc implements jwt.KeyFunc

func (*CATokenValidator) ParseToken

func (c *CATokenValidator) ParseToken(tokenString string) (*jwt.Token, error)

ParseToken take a JWT and validates it against the CATokenValidator root certificate or fallback certificate

func (*CATokenValidator) Verify

func (c *CATokenValidator) Verify(signingCert *pem.Block, chain ...*pem.Block) (bool, error)

Verify takes the signingCert from jwt.Token x5c header and validates its chain against CATokenValidator.RootCA

type MyCustomClaims

type MyCustomClaims struct {
	Foo string `json:"foo"`
	jwt.RegisteredClaims
}

type TestCA

type TestCA struct {
	Passwd string
	Name   string

	CA           *pki.CA
	Intermediate *pki.CA
	LeafCert     *pki.Cert
	// contains filtered or unexported fields
}

func NewTestCA

func NewTestCA(name string) *TestCA

func (*TestCA) GetIntermediateCert

func (c *TestCA) GetIntermediateCert() []byte

func (*TestCA) GetLeafCert

func (c *TestCA) GetLeafCert() []byte

func (*TestCA) GetLeafChain

func (c *TestCA) GetLeafChain() []byte

func (*TestCA) GetLeafKey

func (c *TestCA) GetLeafKey() ([]byte, string)

func (*TestCA) GetRootCert

func (c *TestCA) GetRootCert() []byte

Jump to

Keyboard shortcuts

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