Skip to content

Commit 6d9fa64

Browse files
committed
Changing to SkipSCEPValidation & addressing code
review comments
1 parent c13b180 commit 6d9fa64

File tree

3 files changed

+5
-7
lines changed

3 files changed

+5
-7
lines changed

authority/authority.go

+1-1
Original file line numberDiff line numberDiff line change
@@ -709,7 +709,7 @@ func (a *Authority) init() error {
709709
options := &scep.Options{
710710
Roots: a.rootX509Certs,
711711
Intermediates: a.intermediateX509Certs,
712-
SkipValidation: a.config.SkipValidation,
712+
SkipValidation: a.config.SkipSCEPValidation,
713713
}
714714

715715
// intermediate certificates can be empty in RA mode

authority/config/config.go

+1
Original file line numberDiff line numberDiff line change
@@ -85,6 +85,7 @@ type Config struct {
8585
CRL *CRLConfig `json:"crl,omitempty"`
8686
MetricsAddress string `json:"metricsAddress,omitempty"`
8787
SkipValidation bool `json:"-"`
88+
SkipSCEPValidation bool `json:"-"`
8889

8990
// Keeps record of the filename the Config is read from
9091
loadedFromFilepath string

scep/options.go

+3-6
Original file line numberDiff line numberDiff line change
@@ -26,8 +26,7 @@ type Options struct {
2626
// are used to be able to load the provisioners when the SCEP authority is being
2727
// validated.
2828
SCEPProvisionerNames []string
29-
// SkipValidation is used to skip the validation of the options, when implementing custom
30-
// integrations
29+
// SkipValidation is used to skip the validation of the SCEP options.
3130
SkipValidation bool
3231
}
3332

@@ -37,12 +36,10 @@ type comparablePublicKey interface {
3736

3837
// Validate checks the fields in Options.
3938
func (o *Options) Validate() error {
40-
if o.SkipValidation {
41-
return nil
42-
}
4339
switch {
40+
case o.SkipValidation:
41+
return nil
4442
case len(o.Intermediates) == 0:
45-
return errors.New("no intermediate certificate available for SCEP authority")
4643
case o.SignerCert == nil:
4744
return errors.New("no signer certificate available for SCEP authority")
4845
}

0 commit comments

Comments
 (0)