mirror of
https://github.com/smallstep/certificates.git
synced 2024-10-31 03:20:16 +00:00
Remove unused error from challenge validation controller creator
This commit is contained in:
parent
4f7a4f63f7
commit
c73f157ea4
@ -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?
|
||||
|
||||
|
@ -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())
|
||||
|
Loading…
Reference in New Issue
Block a user