Kaynağa Gözat

Move options to the provisioner.

Mariano Cano 6 yıl önce
ebeveyn
işleme
ca2fb42d68

+ 7 - 6
authority/provisioner/jwk.go

@@ -26,12 +26,13 @@ type stepPayload struct {
 // JWK is the default provisioner, an entity that can sign tokens necessary for
 // JWK is the default provisioner, an entity that can sign tokens necessary for
 // signature requests.
 // signature requests.
 type JWK struct {
 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
 	claimer      *Claimer
 	audiences    Audiences
 	audiences    Audiences
 }
 }

+ 2 - 4
authority/provisioner/provisioner.go

@@ -245,7 +245,7 @@ func (l *List) UnmarshalJSON(data []byte) error {
 			continue
 			continue
 		}
 		}
 		if err := json.Unmarshal(data, p); err != nil {
 		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)
 		*l = append(*l, p)
 	}
 	}
@@ -279,9 +279,7 @@ func SanitizeSSHUserPrincipal(email string) string {
 	}, strings.ToLower(email))
 	}, strings.ToLower(email))
 }
 }
 
 
-type base struct {
-	Options *ProvisionerOptions `json:"options"`
-}
+type base struct{}
 
 
 // AuthorizeSign returns an unimplemented error. Provisioners should overwrite
 // AuthorizeSign returns an unimplemented error. Provisioners should overwrite
 // this method if they will support authorizing tokens for signing x509 Certificates.
 // this method if they will support authorizing tokens for signing x509 Certificates.