mirror of
https://github.com/smallstep/certificates.git
synced 2024-10-31 03:20:16 +00:00
Extract cert storer methods from AuthDB
To be able to extend the AuthDB with methods that also extend the provisioner we need to either create a new method or to split the interface. This change splits the interface so we can have a cleaner implementation.
This commit is contained in:
parent
14524d7916
commit
20b2c6a201
9
db/db.go
9
db/db.go
@ -50,14 +50,19 @@ type AuthDB interface {
|
||||
Revoke(rci *RevokedCertificateInfo) error
|
||||
RevokeSSH(rci *RevokedCertificateInfo) error
|
||||
GetCertificate(serialNumber string) (*x509.Certificate, error)
|
||||
StoreCertificate(crt *x509.Certificate) error
|
||||
UseToken(id, tok string) (bool, error)
|
||||
IsSSHHost(name string) (bool, error)
|
||||
StoreSSHCertificate(crt *ssh.Certificate) error
|
||||
GetSSHHostPrincipals() ([]string, error)
|
||||
Shutdown() error
|
||||
}
|
||||
|
||||
// CertificateStorer is an extension of AuthDB that allows to store
|
||||
// certificates.
|
||||
type CertificateStorer interface {
|
||||
StoreCertificate(crt *x509.Certificate) error
|
||||
StoreSSHCertificate(crt *ssh.Certificate) error
|
||||
}
|
||||
|
||||
// DB is a wrapper over the nosql.DB interface.
|
||||
type DB struct {
|
||||
nosql.DB
|
||||
|
@ -20,7 +20,7 @@ type SimpleDB struct {
|
||||
usedTokens *sync.Map
|
||||
}
|
||||
|
||||
func newSimpleDB(c *Config) (AuthDB, error) {
|
||||
func newSimpleDB(c *Config) (*SimpleDB, error) {
|
||||
db := &SimpleDB{}
|
||||
db.usedTokens = new(sync.Map)
|
||||
return db, nil
|
||||
|
Loading…
Reference in New Issue
Block a user