Prechádzať zdrojové kódy

Denormalize provisioner name in SCEP webhook

Herman Slatman 3 rokov pred
rodič
commit
f082cbc421

+ 1 - 2
authority/provisioner/scep.go

@@ -9,7 +9,6 @@ import (
 	"encoding/pem"
 	"encoding/pem"
 	"fmt"
 	"fmt"
 	"net/http"
 	"net/http"
-	"strings"
 	"time"
 	"time"
 
 
 	"github.com/pkg/errors"
 	"github.com/pkg/errors"
@@ -153,7 +152,7 @@ func (c *challengeValidationController) Validate(ctx context.Context, csr *x509.
 		if err != nil {
 		if err != nil {
 			return fmt.Errorf("failed creating new webhook request: %w", err)
 			return fmt.Errorf("failed creating new webhook request: %w", err)
 		}
 		}
-		req.ProvisionerName = strings.ToLower(provisionerName)
+		req.ProvisionerName = provisionerName
 		req.SCEPChallenge = challenge
 		req.SCEPChallenge = challenge
 		req.SCEPTransactionID = transactionID
 		req.SCEPTransactionID = transactionID
 		resp, err := wh.DoWithContext(ctx, c.client, req, nil) // TODO(hs): support templated URL? Requires some refactoring
 		resp, err := wh.DoWithContext(ctx, c.client, req, nil) // TODO(hs): support templated URL? Requires some refactoring

+ 1 - 1
authority/provisioner/scep_test.go

@@ -254,7 +254,7 @@ func TestSCEP_ValidateChallenge(t *testing.T) {
 		req := &request{}
 		req := &request{}
 		err := json.NewDecoder(r.Body).Decode(req)
 		err := json.NewDecoder(r.Body).Decode(req)
 		require.NoError(t, err)
 		require.NoError(t, err)
-		assert.Equal(t, "scep", req.ProvisionerName)
+		assert.Equal(t, "SCEP", req.ProvisionerName)
 		assert.Equal(t, "webhook-challenge", req.Challenge)
 		assert.Equal(t, "webhook-challenge", req.Challenge)
 		assert.Equal(t, "webhook-transaction-1", req.TransactionID)
 		assert.Equal(t, "webhook-transaction-1", req.TransactionID)
 		if assert.NotNil(t, req.Request) {
 		if assert.NotNil(t, req.Request) {