diff --git a/authority/provisioner/scep.go b/authority/provisioner/scep.go index 0d71df58..c20f9bf1 100644 --- a/authority/provisioner/scep.go +++ b/authority/provisioner/scep.go @@ -96,7 +96,7 @@ type challengeValidationController struct { // newChallengeValidationController creates a new challengeValidationController // that performs challenge validation through webhooks. -func newChallengeValidationController(client *http.Client, webhooks []*Webhook) (*challengeValidationController, error) { +func newChallengeValidationController(client *http.Client, webhooks []*Webhook) *challengeValidationController { scepHooks := []*Webhook{} for _, wh := range webhooks { if wh.Kind != linkedca.Webhook_SCEPCHALLENGE.String() { @@ -110,7 +110,7 @@ func newChallengeValidationController(client *http.Client, webhooks []*Webhook) return &challengeValidationController{ client: client, webhooks: scepHooks, - }, nil + } } var ( @@ -177,12 +177,10 @@ func (s *SCEP) Init(config Config) (err error) { return errors.New("only encryption algorithm identifiers from 0 to 4 are valid") } - if s.challengeValidationController, err = newChallengeValidationController( + s.challengeValidationController = newChallengeValidationController( config.WebhookClient, s.GetOptions().GetWebhooks(), - ); err != nil { - return fmt.Errorf("failed creating challenge validation controller: %w", err) - } + ) // TODO: add other, SCEP specific, options? diff --git a/authority/provisioner/scep_test.go b/authority/provisioner/scep_test.go index 906ad986..acf047fb 100644 --- a/authority/provisioner/scep_test.go +++ b/authority/provisioner/scep_test.go @@ -134,15 +134,14 @@ func Test_challengeValidationController_Validate(t *testing.T) { } for _, tt := range tests { t.Run(tt.name, func(t *testing.T) { - c, err := newChallengeValidationController(tt.fields.client, tt.fields.webhooks) - require.NoError(t, err) + c := newChallengeValidationController(tt.fields.client, tt.fields.webhooks) if tt.server != nil { defer tt.server.Close() } ctx := context.Background() - err = c.Validate(ctx, tt.args.challenge, tt.args.transactionID) + err := c.Validate(ctx, tt.args.challenge, tt.args.transactionID) if tt.expErr != nil { assert.EqualError(t, err, tt.expErr.Error())