Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
var ( // ErrNoSourcesResolved represents an error for when no sources could be resolved at all ErrNoSourcesResolved = ErrGetKeySource{"no sources could be resolved"} // ErrEmptyURL represents an error for when an expected url is an empty string ErrEmptyURL = ErrGetKeySource{"url cannot be empty"} // ErrEmptyFilePath represents an error for when an expected file path is an empty string ErrEmptyFilePath = ErrGetKeySource{"file path cannot be empty"} )
var ( // JWTPublicKeyEnvStringSource represents the source of an RSA public key as a string JWTPublicKeyEnvStringSource = StringSource(os.Getenv("JWT_PUBLIC_KEY")) // JWTPublicKeyEnvHTTPSource represents the source of an RSA public key at a HTTP GET destination JWTPublicKeyEnvHTTPSource = HTTPSource(os.Getenv("JWT_PUBLIC_KEY_URL")) // JWTPublicKeyEnvFileSource represents the source of an RSA public key on disk JWTPublicKeyEnvFileSource = FileSource(os.Getenv("JWT_PUBLIC_KEY_PATH")) // JWTPublicKeyDefaultFileSource represents the source of an RSA public key on disk JWTPublicKeyDefaultFileSource = FileSource("/usr/local/var/jwt.pub") // JWTPublicKeySources represents a chain of sources for JWT Public Keys JWTPublicKeySources = Sources{ JWTPublicKeyEnvStringSource, JWTPublicKeyEnvFileSource, JWTPublicKeyEnvHTTPSource, JWTPublicKeyDefaultFileSource, } )
Functions ¶
This section is empty.
Types ¶
type ErrGetKeySource ¶
type ErrGetKeySource struct {
// contains filtered or unexported fields
}
ErrGetKeySource represents an error when failing to get the source
func (ErrGetKeySource) Error ¶
func (e ErrGetKeySource) Error() string
type ErrReadResponse ¶
type ErrReadResponse struct {
// contains filtered or unexported fields
}
ErrReadResponse represents an error when failing to read the source data
func (ErrReadResponse) Error ¶
func (e ErrReadResponse) Error() string
type HTTPSource ¶
type HTTPSource string
HTTPSource defines a source with a URL to resolve over HTTP
type RSAPublicKeyBroker ¶
type RSAPublicKeyBroker struct {
// contains filtered or unexported fields
}
RSAPublicKeyBroker defines the implementation for brokering an RSA public key
func (*RSAPublicKeyBroker) Copy ¶
func (b *RSAPublicKeyBroker) Copy() rsa.PublicKey
Copy returns a shallow copy o the RSA public key
func (*RSAPublicKeyBroker) Renew ¶
func (b *RSAPublicKeyBroker) Renew()
Renew will inform the broker to force renewal of the key
type RSAPublicKeyBrokerMock ¶
type RSAPublicKeyBrokerMock struct {
// contains filtered or unexported fields
}
RSAPublicKeyBrokerMock defines the implementation for brokering an RSA public key during testing
func (*RSAPublicKeyBrokerMock) Copy ¶
func (b *RSAPublicKeyBrokerMock) Copy() rsa.PublicKey
Copy returns a shallow copy o the RSA public key
type RSAPublicKeyCopier ¶
RSAPublicKeyCopier represents behaviour for distributing copies of public keys
type RSAPublicKeyCopierRenewer ¶
type RSAPublicKeyCopierRenewer interface { RSAPublicKeyCopier Renewer }
RSAPublicKeyCopierRenewer represents the combination of a Copier and Renewer interface
func BrokerRSAPublicKey ¶
func BrokerRSAPublicKey(ctx context.Context, source Source, tick time.Duration) (RSAPublicKeyCopierRenewer, func())
BrokerRSAPublicKey will broker a public key from a source on an interval
func MockRSAPublicKey ¶
func MockRSAPublicKey(key rsa.PublicKey) RSAPublicKeyCopierRenewer
MockRSAPublicKey resolves any source and returns a mocked RSAPublicKeyCopier and Renewer
type Renewer ¶
type Renewer interface {
Renew()
}
Renewer represents behaviour for marking a broker for renewal