mirror of
https://github.com/smallstep/certificates.git
synced 2024-11-17 15:29:21 +00:00
0b5f6487e1
* /provisioners -> /provisioners/jwk-set-by-issuer * /provisioners now returns a list of Provisioners
32 lines
766 B
Go
32 lines
766 B
Go
package provisioner
|
|
|
|
import (
|
|
"errors"
|
|
|
|
jose "gopkg.in/square/go-jose.v2"
|
|
)
|
|
|
|
// Provisioner - authorized entity that can sign tokens necessary for signature requests.
|
|
type Provisioner struct {
|
|
Issuer string `json:"issuer,omitempty"`
|
|
Type string `json:"type,omitempty"`
|
|
Key *jose.JSONWebKey `json:"key,omitempty"`
|
|
EncryptedKey string `json:"encryptedKey,omitempty"`
|
|
}
|
|
|
|
// Validate validates a provisioner.
|
|
func (p *Provisioner) Validate() error {
|
|
switch {
|
|
case p.Issuer == "":
|
|
return errors.New("provisioner issuer cannot be empty")
|
|
|
|
case p.Type == "":
|
|
return errors.New("provisioner type cannot be empty")
|
|
|
|
case p.Key == nil:
|
|
return errors.New("provisioner key cannot be empty")
|
|
}
|
|
|
|
return nil
|
|
}
|