feat(credential): Add specific credential types (#1525)

This adds interfaces for the following credential types:
- Username and password
- Username and private key
- Certificate and private key

It also adds the following types for redacting secret data:
- Password
- PrivateKey
This commit is contained in:
Michael Gaffney authored and GitHub committed 2021-09-14 14:11:42 -04:00
1 parent 2afac7348a
commit e9d3cebd45
3 files changed
+199

No files matched your search

+28
View File
@@ -87,3 +87,31 @@ type Revoker interface {
// Revoke revokes the dynamic credentials issued for sessionid.
Revoke(ctx context.Context, sessionId string) error
}
// Password represents a secret password.
type Password string
// PrivateKey represents a secret private key.
type PrivateKey []byte
// UserPassword is a credential containing a username and a password.
type UserPassword interface {
Credential
Username() string
Password() Password
}
// KeyPair is a credential containing a username and a private key.
type KeyPair interface {
Credential
Username() string
Private() PrivateKey
}
// Certificate is a credential containing a certificate and the private key
// for the certificate.
type Certificate interface {
Credential
Certificate() []byte
Private() PrivateKey
}