certificates/authority/provisioner/noop.go

68 lines
1.3 KiB
Go
Raw Normal View History

package provisioner
import (
"context"
"crypto/x509"
"golang.org/x/crypto/ssh"
)
// noop provisioners is a provisioner that accepts anything.
type noop struct{}
func (p *noop) GetID() string {
return "noop"
}
2021-05-20 01:23:20 +00:00
func (p *noop) GetIDForToken() string {
return "noop"
}
2023-05-10 06:47:28 +00:00
func (p *noop) GetTokenID(string) (string, error) {
return "", nil
}
func (p *noop) GetName() string {
return "noop"
}
func (p *noop) GetType() Type {
return noopType
}
func (p *noop) GetEncryptedKey() (kid, key string, ok bool) {
return "", "", false
}
2023-05-10 06:47:28 +00:00
func (p *noop) Init(Config) error {
return nil
}
2023-05-10 06:47:28 +00:00
func (p *noop) AuthorizeSign(context.Context, string) ([]SignOption, error) {
return []SignOption{p}, nil
}
2023-05-10 06:47:28 +00:00
func (p *noop) AuthorizeRenew(context.Context, *x509.Certificate) error {
return nil
}
2023-05-10 06:47:28 +00:00
func (p *noop) AuthorizeRevoke(context.Context, string) error {
return nil
}
2023-05-10 06:47:28 +00:00
func (p *noop) AuthorizeSSHSign(context.Context, string) ([]SignOption, error) {
return []SignOption{p}, nil
}
2023-05-10 06:47:28 +00:00
func (p *noop) AuthorizeSSHRenew(context.Context, string) (*ssh.Certificate, error) {
//nolint:nilnil // fine for noop
return nil, nil
}
2023-05-10 06:47:28 +00:00
func (p *noop) AuthorizeSSHRevoke(context.Context, string) error {
return nil
}
2023-05-10 06:47:28 +00:00
func (p *noop) AuthorizeSSHRekey(context.Context, string) (*ssh.Certificate, []SignOption, error) {
return nil, []SignOption{}, nil
}