spiffe

package
v0.5.2 Latest Latest
Warning

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

Go to latest
Published: Jun 7, 2026 License: Apache-2.0 Imports: 18 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type CredentialProvider

type CredentialProvider struct {
	Options Options

	// Source is the SVID source used by the keypair and cert provider. When
	// nil, Prepare opens a workloadapi.X509Source against Options.SocketPath.
	// Tests inject a fake source to exercise the provider without a running
	// Workload API.
	Source x509svid.Source
	// contains filtered or unexported fields
}

CredentialProvider implements bundle.CredentialProvider using X.509-SVIDs from the SPIFFE Workload API. The Workload API stream is opened at Prepare time and rotates automatically; callers should invoke Close when done.

func NewCredentialProvider

func NewCredentialProvider(opts Options) *CredentialProvider

NewCredentialProvider creates a SPIFFE CredentialProvider with the given options.

func (*CredentialProvider) CertificateProvider

CertificateProvider returns the provider that yields the current SVID leaf. No provider options are required for the SPIFFE path.

func (*CredentialProvider) Close

func (p *CredentialProvider) Close() error

Close releases any workloadapi.X509Source opened by Prepare. Sources injected by callers are not closed here — the caller owns their lifecycle.

func (*CredentialProvider) Intermediates

func (p *CredentialProvider) Intermediates() []*x509.Certificate

Intermediates returns the certs between the SVID leaf and the trust domain root, taken from the current SVID. The trust anchor itself is NOT included — verifiers pin it out-of-band.

func (*CredentialProvider) Keypair

func (p *CredentialProvider) Keypair() sign.Keypair

Keypair returns the sign.Keypair backed by the SVID private key.

func (*CredentialProvider) Prepare

func (p *CredentialProvider) Prepare(ctx context.Context) error

Prepare connects to the Workload API (if no Source was injected) and verifies that an SVID is available. Subsequent calls are no-ops.

type Options

type Options struct {
	// SocketPath is the Workload API endpoint (typically "unix:///...").
	// When empty, go-spiffe reads SPIFFE_ENDPOINT_SOCKET from the environment.
	SocketPath string

	// ExpectedTrustDomain, when non-zero, asserts that the issued SVID
	// belongs to this trust domain. Mismatch causes Prepare to fail.
	ExpectedTrustDomain spiffeid.TrustDomain
}

Options configures a SPIFFE CredentialProvider.

Directories

Path Synopsis
Package verifier validates SPIFFE-signed bundles against a pinned SPIRE trust root and enforces SPIFFE identity matchers on the SVID leaf.
Package verifier validates SPIFFE-signed bundles against a pinned SPIRE trust root and enforces SPIFFE identity matchers on the SVID leaf.

Jump to

Keyboard shortcuts

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