mock

package
v0.0.0-...-743a49b Latest Latest
Warning

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

Go to latest
Published: May 9, 2024 License: Apache-2.0 Imports: 7 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type CAClient

type CAClient struct {
	SignInvokeCount uint64

	GeneratedCerts [][]string // Cache the generated certificates for verification purpose.
	// contains filtered or unexported fields
}

CAClient is the mocked CAClient for testing.

func NewMockCAClient

func NewMockCAClient(certLifetime time.Duration, mockTrustAnchor bool) (*CAClient, error)

NewMockCAClient creates an instance of CAClient. errors is used to specify the number of errors before CSRSign returns a valid response. certLifetime specifies the TTL for the newly issued workload cert.

func (*CAClient) CSRSign

func (c *CAClient) CSRSign(csrPEM []byte, certValidTTLInSec int64) ([]string, error)

CSRSign returns the certificate or errors depending on the settings.

func (*CAClient) Close

func (c *CAClient) Close()

func (*CAClient) GetRootCertBundle

func (c *CAClient) GetRootCertBundle() ([]string, error)

type TokenExchangeServer

type TokenExchangeServer struct {
	// contains filtered or unexported fields
}

TokenExchangeServer is the mocked token exchange server for testing.

func NewMockTokenExchangeServer

func NewMockTokenExchangeServer(exchangeMap map[string]string) *TokenExchangeServer

NewMockTokenExchangeServer creates an instance of TokenExchangeServer. errors is used to specify the number of errors before ExchangeToken returns a dumb token.

func (*TokenExchangeServer) ExchangeToken

func (s *TokenExchangeServer) ExchangeToken(token string) (string, error)

ExchangeToken returns a dumb token or errors depending on the settings.

Jump to

Keyboard shortcuts

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