gofmted the code

pull/307/head
dharanikumar-s 4 years ago
parent 0c21f0ae9e
commit a3b5211e0f

@ -551,7 +551,7 @@ type mockAuthority struct {
getTLSOptions func() *tlsutil.TLSOptions
root func(shasum string) (*x509.Certificate, error)
sign func(cr *x509.CertificateRequest, opts provisioner.Options, signOpts ...provisioner.SignOption) ([]*x509.Certificate, error)
renew func(cert *x509.Certificate) ([]*x509.Certificate, error)
renew func(cert *x509.Certificate) ([]*x509.Certificate, error)
renewOrRekey func(oldCert *x509.Certificate, pk crypto.PublicKey) ([]*x509.Certificate, error)
loadProvisionerByCertificate func(cert *x509.Certificate) (provisioner.Interface, error)
loadProvisionerByID func(provID string) (provisioner.Interface, error)

@ -8,7 +8,7 @@ import (
// RekeyRequest is the request body for a certificate rekey request.
type RekeyRequest struct {
CsrPEM CertificateRequest `json:"csr"`
CsrPEM CertificateRequest `json:"csr"`
}
// Validate checks the fields of the RekeyRequest and returns nil if they are ok
@ -24,7 +24,6 @@ func (s *RekeyRequest) Validate() error {
return nil
}
// Rekey is similar to renew except that the certificate will be renewed with new key from csr.
func (h *caHandler) Rekey(w http.ResponseWriter, r *http.Request) {
@ -39,13 +38,12 @@ func (h *caHandler) Rekey(w http.ResponseWriter, r *http.Request) {
return
}
if err := body.Validate(); err != nil {
WriteError(w, err)
return
}
certChain, err := h.Authority.RenewOrRekey(r.TLS.PeerCertificates[0],body.CsrPEM.CertificateRequest.PublicKey)
certChain, err := h.Authority.RenewOrRekey(r.TLS.PeerCertificates[0], body.CsrPEM.CertificateRequest.PublicKey)
if err != nil {
WriteError(w, errs.Wrap(http.StatusInternalServerError, err, "cahandler.Rekey"))
return

Loading…
Cancel
Save