From ca2fb42d68b82285784135c2926b45b23bffe8cb Mon Sep 17 00:00:00 2001 From: Mariano Cano Date: Wed, 8 Jul 2020 19:02:35 -0700 Subject: [PATCH] Move options to the provisioner. --- authority/provisioner/jwk.go | 13 +++++++------ authority/provisioner/provisioner.go | 6 ++---- 2 files changed, 9 insertions(+), 10 deletions(-) diff --git a/authority/provisioner/jwk.go b/authority/provisioner/jwk.go index 6857eea8..c12beac8 100644 --- a/authority/provisioner/jwk.go +++ b/authority/provisioner/jwk.go @@ -26,12 +26,13 @@ type stepPayload struct { // JWK is the default provisioner, an entity that can sign tokens necessary for // signature requests. type JWK struct { - base - Type string `json:"type"` - Name string `json:"name"` - Key *jose.JSONWebKey `json:"key"` - EncryptedKey string `json:"encryptedKey,omitempty"` - Claims *Claims `json:"claims,omitempty"` + *base + Type string `json:"type"` + Name string `json:"name"` + Key *jose.JSONWebKey `json:"key"` + EncryptedKey string `json:"encryptedKey,omitempty"` + Claims *Claims `json:"claims,omitempty"` + Options *ProvisionerOptions `json:"options"` claimer *Claimer audiences Audiences } diff --git a/authority/provisioner/provisioner.go b/authority/provisioner/provisioner.go index 26ead6ff..c413a100 100644 --- a/authority/provisioner/provisioner.go +++ b/authority/provisioner/provisioner.go @@ -245,7 +245,7 @@ func (l *List) UnmarshalJSON(data []byte) error { continue } if err := json.Unmarshal(data, p); err != nil { - return errors.Errorf("error unmarshaling provisioner") + return errors.Wrap(err, "error unmarshaling provisioner") } *l = append(*l, p) } @@ -279,9 +279,7 @@ func SanitizeSSHUserPrincipal(email string) string { }, strings.ToLower(email)) } -type base struct { - Options *ProvisionerOptions `json:"options"` -} +type base struct{} // AuthorizeSign returns an unimplemented error. Provisioners should overwrite // this method if they will support authorizing tokens for signing x509 Certificates.