Remove superfluous GetChallengePassword

This commit is contained in:
Herman Slatman 2023-05-04 11:43:57 +02:00
parent f9ec62f46c
commit 0153ff4377
No known key found for this signature in database
GPG key ID: F4D8A44EA0A75A4F
2 changed files with 3 additions and 8 deletions

View file

@ -201,11 +201,6 @@ func (s *SCEP) AuthorizeSign(ctx context.Context, token string) ([]SignOption, e
}, nil }, nil
} }
// GetChallengePassword returns the challenge password
func (s *SCEP) GetChallengePassword() string {
return s.ChallengePassword
}
// GetCapabilities returns the CA capabilities // GetCapabilities returns the CA capabilities
func (s *SCEP) GetCapabilities() []string { func (s *SCEP) GetCapabilities() []string {
return s.Capabilities return s.Capabilities
@ -236,7 +231,7 @@ func (s *SCEP) ValidateChallenge(ctx context.Context, challenge, transactionID s
case validationMethodWebhook: case validationMethodWebhook:
return s.challengeValidationController.Validate(ctx, challenge, transactionID) return s.challengeValidationController.Validate(ctx, challenge, transactionID)
default: default:
if subtle.ConstantTimeCompare([]byte(s.secretChallengePassword), []byte(challenge)) == 0 { if subtle.ConstantTimeCompare([]byte(s.ChallengePassword), []byte(challenge)) == 0 {
return errors.New("invalid challenge password provided") return errors.New("invalid challenge password provided")
} }
return nil return nil
@ -259,7 +254,7 @@ func (s *SCEP) selectValidationMethod() validationMethod {
if len(s.challengeValidationController.webhooks) > 0 { if len(s.challengeValidationController.webhooks) > 0 {
return validationMethodWebhook return validationMethodWebhook
} }
if s.secretChallengePassword != "" { if s.ChallengePassword != "" {
return validationMethodStatic return validationMethodStatic
} }
return validationMethodNone return validationMethodNone

View file

@ -1223,7 +1223,7 @@ func ProvisionerToLinkedca(p provisioner.Interface) (*linkedca.Provisioner, erro
Data: &linkedca.ProvisionerDetails_SCEP{ Data: &linkedca.ProvisionerDetails_SCEP{
SCEP: &linkedca.SCEPProvisioner{ SCEP: &linkedca.SCEPProvisioner{
ForceCn: p.ForceCN, ForceCn: p.ForceCN,
Challenge: p.GetChallengePassword(), Challenge: p.ChallengePassword,
Capabilities: p.Capabilities, Capabilities: p.Capabilities,
MinimumPublicKeyLength: int32(p.MinimumPublicKeyLength), MinimumPublicKeyLength: int32(p.MinimumPublicKeyLength),
IncludeRoot: p.IncludeRoot, IncludeRoot: p.IncludeRoot,