Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type AzureIdentityFileReader ¶
type AzureIdentityFileReader struct {
// contains filtered or unexported fields
}
AzureIdentityFileReader implements CertificateReader for file-based certificates that are used to authenticate with an Azure identity.
func NewAzureIdentityFileReader ¶
func NewAzureIdentityFileReader(filePath string) *AzureIdentityFileReader
NewAzureIdentityFileReader creates a new file-based certificate reader.
func (*AzureIdentityFileReader) ReadCertificate ¶
func (f *AzureIdentityFileReader) ReadCertificate() ([]*x509.Certificate, crypto.PrivateKey, error)
ReadCertificate reads and parses the certificate from the file. It expects the certificate to be in PEM or PKCS#12 format. Keys in PEM format or PKCS#12 certificates that use SHA256 for message authentication are not supported. ParseCertificates loads certificates and a private key, in PEM or PKCS#12 format, for use with [NewClientCertificateCredential]. Pass nil for password if the private key isn't encrypted. This function has limitations, for example it can't decrypt keys in PEM format or PKCS#12 certificates that use SHA256 for message authentication. If you encounter such limitations, consider using another module to load the certificate and private key.
type MockReader ¶
type MockReader struct {
Certs []*x509.Certificate
Key crypto.PrivateKey
Err error
}
MockReader is a simple mock for testing FirstPartyApplicationTokenCredentialRetriever
func (*MockReader) ReadCertificate ¶
func (m *MockReader) ReadCertificate() ([]*x509.Certificate, crypto.PrivateKey, error)
type Reader ¶
type Reader interface {
// ReadCertificate reads and parses the certificate and private key.
ReadCertificate() ([]*x509.Certificate, crypto.PrivateKey, error)
}
type WatchingAzureIdentityFileReader ¶
type WatchingAzureIdentityFileReader struct {
// contains filtered or unexported fields
}
WatchingAzureIdentityFileReader wraps AzureIdentityFileReader with caching and automatic reloading. It watches the certificate file and reloads when changes are detected.
func NewWatchingAzureIdentityFileReader ¶
func NewWatchingAzureIdentityFileReader(ctx context.Context, filePath string) (*WatchingAzureIdentityFileReader, error)
NewWatchingAzureIdentityFileReader creates a new watching certificate reader. It loads the initial certificate and starts watching for changes. The logger is obtained from the context using utils.LoggerFromContext.
func (*WatchingAzureIdentityFileReader) ReadCertificate ¶
func (w *WatchingAzureIdentityFileReader) ReadCertificate() ([]*x509.Certificate, crypto.PrivateKey, error)
ReadCertificate returns the cached certificate.
func (*WatchingAzureIdentityFileReader) Run ¶
func (w *WatchingAzureIdentityFileReader) Run(ctx context.Context, checkInterval time.Duration) error
Run starts watching the certificate file for changes. When changes are detected, the reload callback is invoked. Watching continues until the context is canceled.