Skip to content

Commit 5fb8406

Browse files
authored
removed validation for ca revoke capability
* removed validation for ca revoke capability * removed test related to ca revoke validation * removed not used ca revoke data
1 parent bc90e1a commit 5fb8406

File tree

3 files changed

+0
-59
lines changed

3 files changed

+0
-59
lines changed

pkg/venafi/cloud/cloud.go

Lines changed: 0 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -74,16 +74,6 @@ const (
7474
TeamType
7575
)
7676

77-
var CATypesSupportedForRevocationSlice = []string{
78-
"DIGICERT", "MICROSOFT", "ZTPKI",
79-
}
80-
81-
var CATypesSupportedForRevocation = map[string]bool{
82-
CATypesSupportedForRevocationSlice[0]: true,
83-
CATypesSupportedForRevocationSlice[1]: true,
84-
CATypesSupportedForRevocationSlice[2]: true,
85-
}
86-
8777
// RevocationReasonsMap maps *certificate.RevocationRequest.Reason to ca-operations reasons
8878
var RevocationReasonsMap = map[string]service.RevocationReason{
8979
"": service.RevocationReasonUnspecified, // NoReason

pkg/venafi/cloud/connector.go

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -606,12 +606,6 @@ func (c *Connector) RevokeCertificate(revReq *certificate.RevocationRequest) (en
606606
return nil, fmt.Errorf("failed to find CA account %q", revReq.CertificateAuthorityAccountName)
607607
}
608608

609-
//validating the CAType is into the set of supported types to perform revocation
610-
if !CATypesSupportedForRevocation[caAccount.CertificateAuthorityType] {
611-
return nil, fmt.Errorf("the CA type of the CA account %q is not supported for revocation. "+
612-
"It is only supported CA accounts of type %s", caAccount.Name, util.GetQuotedStrings(CATypesSupportedForRevocationSlice))
613-
}
614-
615609
certificateAuthorityAccountId = &caAccount.Id
616610
}
617611

pkg/venafi/cloud/connector_test.go

Lines changed: 0 additions & 43 deletions
Original file line numberDiff line numberDiff line change
@@ -1078,49 +1078,6 @@ func TestRevokeCertificate(t *testing.T) {
10781078
require.Error(t, err)
10791079
require.ErrorContains(t, err, fmt.Sprintf("failed to find CA account %q", revReq.CertificateAuthorityAccountName))
10801080
})
1081-
t.Run("failed-unsupported ca type", func(t *testing.T) {
1082-
mockCtrl := gomock.NewController(t)
1083-
defer mockCtrl.Finish()
1084-
1085-
caAccountId := "myId"
1086-
caAccountName := "MyAccountName"
1087-
thumbprint := "MyThumbprint"
1088-
1089-
revReq := &certificate.RevocationRequest{
1090-
Thumbprint: thumbprint,
1091-
Reason: "",
1092-
CertificateAuthorityAccountName: caAccountName,
1093-
}
1094-
1095-
//1. mocking the caAccountsClient
1096-
caAccountExpected := &caaccountssservice.ListCAAccountsCertificateAuthorityAccountsCertificateAuthorityAccountConnectionNodesCertificateAuthorityAccount{
1097-
Id: caAccountId,
1098-
Name: "MyAccountName",
1099-
CertificateAuthorityType: caaccountssservice.CertificateAuthorityTypeGlobalsign,
1100-
}
1101-
1102-
listCAAccountsResponse := &caaccountssservice.ListCAAccountsResponse{
1103-
CertificateAuthorityAccounts: &caaccountssservice.ListCAAccountsCertificateAuthorityAccountsCertificateAuthorityAccountConnection{
1104-
Nodes: []*caaccountssservice.ListCAAccountsCertificateAuthorityAccountsCertificateAuthorityAccountConnectionNodesCertificateAuthorityAccount{
1105-
caAccountExpected,
1106-
},
1107-
},
1108-
}
1109-
1110-
caAccountsService := mocks.NewMockCAAccountsServiceWrapper(mockCtrl)
1111-
caAccountsService.EXPECT().ListCAAccounts(context.Background()).Return(listCAAccountsResponse, nil)
1112-
1113-
//replacing the caAccountsService reference with the mock
1114-
conn.caAccountsClient.SetCAAccountsService(caAccountsService)
1115-
1116-
revokeCertificate, err := conn.RevokeCertificate(revReq)
1117-
require.Nil(t, revokeCertificate)
1118-
require.Error(t, err)
1119-
//require.ErrorContains(t, err, fmt.Sprintf("unsupported CA type for revocation: %s", caAccountExpected.CertificateAuthorityType))
1120-
require.ErrorContains(t, err, fmt.Sprintf("the CA type of the CA account %q is not supported for revocation. "+
1121-
"It is only supported CA accounts of type %s", caAccountExpected.Name, util.GetQuotedStrings(CATypesSupportedForRevocationSlice)))
1122-
})
1123-
11241081
}
11251082

11261083
func TestReadPolicyConfigurationOnlyEC(t *testing.T) {

0 commit comments

Comments
 (0)