Documentation
¶
Overview ¶
Package mock provides an in-memory mock implementation of the backend interfaces for testing.
Index ¶
- type PolicyProvider
- type Signer
- func (s *Signer) Enroll(_ context.Context, csr *x509.CertificateRequest, _ string) (*backend.EnrollmentResult, error)
- func (s *Signer) Poll(_ context.Context, requestID string) (*backend.EnrollmentResult, error)
- func (s *Signer) Renew(ctx context.Context, _ *x509.Certificate, csr *x509.CertificateRequest) (*backend.EnrollmentResult, error)
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type PolicyProvider ¶
type PolicyProvider struct {
Policies *backend.PolicyResponse
}
PolicyProvider is a mock backend.PolicyProvider with static policies.
func NewPolicyProvider ¶
func NewPolicyProvider() *PolicyProvider
NewPolicyProvider creates a mock PolicyProvider with a default template.
func (*PolicyProvider) GetPolicies ¶
func (p *PolicyProvider) GetPolicies(_ context.Context) (*backend.PolicyResponse, error)
type Signer ¶
type Signer struct {
// IssuerCert is used as the CA certificate for signing.
IssuerCert *x509.Certificate
IssuerKey *ecdsa.PrivateKey
// PendingRequestIDs tracks requests that should be returned as pending.
PendingRequestIDs map[string]bool
}
Signer is a mock backend.Signer that issues self-signed certificates.
func NewPersistentSigner ¶
NewPersistentSigner creates a mock Signer whose CA certificate and key are loaded from dir if present, or generated and saved there otherwise. This keeps the CA stable across restarts so clients only need to trust it once.
func (*Signer) Enroll ¶
func (s *Signer) Enroll(_ context.Context, csr *x509.CertificateRequest, _ string) (*backend.EnrollmentResult, error)
func (*Signer) Renew ¶
func (s *Signer) Renew(ctx context.Context, _ *x509.Certificate, csr *x509.CertificateRequest) (*backend.EnrollmentResult, error)
Click to show internal directories.
Click to hide internal directories.