gofmted the code

This commit is contained in:
dharanikumar-s 2020-07-05 22:40:36 +05:30
parent 0c21f0ae9e
commit a3b5211e0f
2 changed files with 3 additions and 5 deletions

View file

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

View file

@ -8,7 +8,7 @@ import (
// RekeyRequest is the request body for a certificate rekey request. // RekeyRequest is the request body for a certificate rekey request.
type RekeyRequest struct { 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 // 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 return nil
} }
// Rekey is similar to renew except that the certificate will be renewed with new key from csr. // 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) { 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 return
} }
if err := body.Validate(); err != nil { if err := body.Validate(); err != nil {
WriteError(w, err) WriteError(w, err)
return 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 { if err != nil {
WriteError(w, errs.Wrap(http.StatusInternalServerError, err, "cahandler.Rekey")) WriteError(w, errs.Wrap(http.StatusInternalServerError, err, "cahandler.Rekey"))
return return