Skip to content

Commit 79911d3

Browse files
indrorairbydoebrowskKeyfactor
authored
release:1.2.1 (#9)
* chore: bump GH Actions, break steps down into smaller parts, and get on v2 integration-manifest * chore: rename tests, optimize tests to reduce computational overhead for creating test certs, etc. * chore: remove OTE references from documentation * chore: update changelog * Update generated docs --------- Signed-off-by: Matthew H. Irby <matt.irby@keyfactor.com> Co-authored-by: Matthew H. Irby <irby@users.noreply.github.com> Co-authored-by: Macey <11599974+doebrowsk@users.noreply.github.com> Co-authored-by: Keyfactor <keyfactor@keyfactor.github.io>
1 parent 57072b7 commit 79911d3

15 files changed

+101
-106
lines changed

.github/workflows/keyfactor-bootstrap-workflow.yml

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,10 +11,13 @@ on:
1111

1212
jobs:
1313
call-starter-workflow:
14-
uses: keyfactor/actions/.github/workflows/starter.yml@v3
14+
uses: keyfactor/actions/.github/workflows/starter.yml@v4
1515
secrets:
1616
token: ${{ secrets.V2BUILDTOKEN}}
17-
APPROVE_README_PUSH: ${{ secrets.APPROVE_README_PUSH}}
1817
gpg_key: ${{ secrets.KF_GPG_PRIVATE_KEY }}
1918
gpg_pass: ${{ secrets.KF_GPG_PASSPHRASE }}
2019
scan_token: ${{ secrets.SAST_TOKEN }}
20+
entra_username: ${{ secrets.DOCTOOL_ENTRA_USERNAME }}
21+
entra_password: ${{ secrets.DOCTOOL_ENTRA_PASSWD }}
22+
command_client_id: ${{ secrets.DOCTOOL_COMMAND_CLIENT_ID }}
23+
command_client_secret: ${{ secrets.DOCTOOL_COMMAND_CLIENT_SECRET }}

.github/workflows/tests.yml

Lines changed: 10 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -9,21 +9,25 @@ jobs:
99
# Checkout code
1010
# https://github.com/actions/checkout
1111
- name: Checkout code
12-
uses: actions/checkout@v4
12+
uses: actions/checkout@v5
1313

1414
# Setup dotnet 8.0
1515
# https://github.com/actions/setup-dotnet
16-
- uses: actions/setup-dotnet@v3
16+
- uses: actions/setup-dotnet@v5
1717
with:
1818
dotnet-version: '8.x'
1919

2020
# Setup nuget
21-
- name: Setup build environment
21+
- name: Add Keyfactor NuGet Source
2222
run: |
2323
dotnet nuget add source https://nuget.pkg.github.com/Keyfactor/index.json -n github -u ${{ github.actor }} -p ${{ secrets.V2BUILDTOKEN }} --store-password-in-clear-text
24-
dotnet restore
24+
25+
- name: Restore dependencies
26+
run: dotnet restore
27+
28+
- name: Build solution
29+
run: dotnet build --no-restore --configuration Release
2530

2631
# Build and test dotnet project
2732
- name: Build and Test
28-
run: dotnet test
29-
33+
run: dotnet test --no-build --configuration Release

.gitignore

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -350,3 +350,5 @@ healthchecksdb
350350
*/C:
351351

352352
logs
353+
354+
.env

CHANGELOG.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,7 @@
1+
# v1.2.1
2+
## Chores
3+
- Add note about OTE API keys not being supported with this integration due to shopper ID resolution requirements.
4+
15
# v1.2.0
26
- Add special condition to handle status 409 when downloading certificates from GoDaddy. 409 indicates that the certificate state does not allow download.
37

GoDaddy.Tests/FakeCaConfigProvider.cs renamed to GoDaddy.Tests/Fakes/FakeCaConfigProvider.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
// Copyright 2024 Keyfactor
1+
// Copyright 2026 Keyfactor
22
//
33
// Licensed under the Apache License, Version 2.0 (the "License");
44
// you may not use this file except in compliance with the License.

GoDaddy.Tests/FakeCertificateDataReader.cs renamed to GoDaddy.Tests/Fakes/FakeCertificateDataReader.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
// Copyright 2024 Keyfactor
1+
// Copyright 2026 Keyfactor
22
//
33
// Licensed under the Apache License, Version 2.0 (the "License");
44
// you may not use this file except in compliance with the License.
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
// Copyright 2024 Keyfactor
1+
// Copyright 2026 Keyfactor
22
//
33
// Licensed under the Apache License, Version 2.0 (the "License");
44
// you may not use this file except in compliance with the License.

GoDaddy.Tests/GoDaddy.Tests.csproj

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -21,12 +21,12 @@
2121
<Using Include="Xunit" />
2222
</ItemGroup>
2323

24-
<ItemGroup>
25-
<ProjectReference Include="..\GoDaddy\GoDaddy.csproj" />
24+
<ItemGroup>
25+
<ProjectReference Include="..\GoDaddy\GoDaddy.csproj" />
26+
</ItemGroup>
27+
28+
<ItemGroup>
29+
<Content Include="xunit.runner.json" CopyToOutputDirectory="PreserveNewest" />
2630
</ItemGroup>
27-
28-
<ItemGroup>
29-
<Content Include="xunit.runner.json" CopyToOutputDirectory="PreserveNewest" />
30-
</ItemGroup>
3131

3232
</Project>
Lines changed: 34 additions & 48 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
// Copyright 2024 Keyfactor
1+
// Copyright 2026 Keyfactor
22
//
33
// Licensed under the Apache License, Version 2.0 (the "License");
44
// you may not use this file except in compliance with the License.
@@ -28,6 +28,15 @@ namespace Keyfactor.Extensions.CAPlugin.GoDaddyTests;
2828

2929
public class GoDaddyCAPluginTests
3030
{
31+
private static readonly DateTimeOffset NotBefore = DateTimeOffset.Now.AddDays(-100);
32+
private static readonly DateTimeOffset ReissueNotAfter = DateTimeOffset.Now.AddDays(365);
33+
private static readonly DateTimeOffset RenewalNotAfter = DateTimeOffset.Now.AddDays(59);
34+
35+
private const string TestSubject = "CN=Test Subject";
36+
private static readonly string TestCsr = GenerateCSR(TestSubject);
37+
private static readonly X509Certificate2 FakeReissueCertificate = FakeGoDaddyClient.GenerateSelfSignedCertificate(RSA.Create(2048), "CN=Test Cert", NotBefore, ReissueNotAfter);
38+
private static readonly X509Certificate2 FakeRenewalCertificate = FakeGoDaddyClient.GenerateSelfSignedCertificate(RSA.Create(2048), "CN=Test Cert", NotBefore, RenewalNotAfter);
39+
3140
ILogger _logger { get; set;}
3241

3342
public GoDaddyCAPluginTests()
@@ -253,7 +262,7 @@ public void GoDaddyCAPlugin_ValidateProductInfo_EV_InvalidParameters_ReturnFailu
253262
[InlineData("UCC_DV_SSL")]
254263
[InlineData("UCC_EV_SSL")]
255264
[InlineData("UCC_OV_SSL")]
256-
public void GoDaddyCAPlugin_Enroll_ReturnSuccess(string productID)
265+
public async Task GoDaddyCAPlugin_Enroll_ReturnSuccess(string productID)
257266
{
258267
// Arrange
259268
FakeGoDaddyClient fakeClient = new FakeGoDaddyClient();
@@ -267,10 +276,6 @@ public void GoDaddyCAPlugin_Enroll_ReturnSuccess(string productID)
267276
Client = fakeClient
268277
};
269278
plugin.Initialize(configProvider, certificateDataReader);
270-
271-
// CSR
272-
string subject = "CN=Test Subject";
273-
string csrString = GenerateCSR(subject);
274279

275280
Dictionary<string, string[]> sans = new();
276281

@@ -307,10 +312,10 @@ public void GoDaddyCAPlugin_Enroll_ReturnSuccess(string productID)
307312
EnrollmentType type = EnrollmentType.New;
308313

309314
// Act
310-
EnrollmentResult result = plugin.Enroll(csrString, subject, sans, productInfo, format, type).Result;
315+
EnrollmentResult result = await plugin.Enroll(TestCsr, TestSubject, sans, productInfo, format, type);
311316

312317
// Assert
313-
Assert.Equal(result.Status, (int)EndEntityStatus.GENERATED);
318+
Assert.Equal((int)EndEntityStatus.GENERATED, result.Status);
314319
}
315320

316321
[Theory]
@@ -324,12 +329,13 @@ public void GoDaddyCAPlugin_Enroll_ReturnSuccess(string productID)
324329
[InlineData("UCC_DV_SSL")]
325330
[InlineData("UCC_EV_SSL")]
326331
[InlineData("UCC_OV_SSL")]
327-
public void GoDaddyCAPlugin_Renew_ReturnSuccess(string productID)
332+
public async Task GoDaddyCAPlugin_Renew_ReturnSuccess(string productID)
328333
{
329334
// Arrange
330-
DateTime enrollmentNotBefore = DateTime.UtcNow.AddDays(-5);
331-
DateTime enrollmentNotAfter = DateTime.UtcNow.AddDays(20);
332-
X509Certificate2 fakeCertificate = FakeGoDaddyClient.GenerateSelfSignedCertificate(RSA.Create(2048), "CN=Test Cert", enrollmentNotBefore, enrollmentNotAfter);
335+
336+
// Renewal is only available 60 days prior to expiration of the previous certificate and 30 days after the
337+
// expiration of the previous certificate.
338+
333339
string fakeCaRequestId = Guid.NewGuid().ToString();
334340

335341
FakeGoDaddyClient fakeClient = new FakeGoDaddyClient()
@@ -339,20 +345,14 @@ public void GoDaddyCAPlugin_Renew_ReturnSuccess(string productID)
339345
{ fakeCaRequestId, new AnyCAPluginCertificate
340346
{
341347
CARequestID = fakeCaRequestId,
342-
Certificate = fakeCertificate.ExportCertificatePem(),
348+
Certificate = FakeRenewalCertificate.ExportCertificatePem(),
343349
Status = 123,
344350
ProductID = productID,
345351
}
346352
}
347353
}
348354
};
349355

350-
// Renewal is only available 60 days prior to expiration of the previous certificate and 30 days after the
351-
// expiration of the previous certificate.
352-
353-
fakeClient.EnrollmentNotBefore = enrollmentNotBefore;
354-
fakeClient.EnrollmentNotAfter = enrollmentNotAfter;
355-
356356
BlockingCollection<AnyCAPluginCertificate> certificates = new BlockingCollection<AnyCAPluginCertificate>();
357357

358358
IAnyCAPluginConfigProvider configProvider = new FakeCaConfigProvider(new Config());
@@ -364,10 +364,6 @@ public void GoDaddyCAPlugin_Renew_ReturnSuccess(string productID)
364364
};
365365
plugin.Initialize(configProvider, certificateDataReader);
366366

367-
// CSR
368-
string subject = "CN=Test Subject";
369-
string csrString = GenerateCSR(subject);
370-
371367
Dictionary<string, string[]> sans = new();
372368

373369
EnrollmentProductInfo productInfo = new EnrollmentProductInfo
@@ -394,7 +390,7 @@ public void GoDaddyCAPlugin_Renew_ReturnSuccess(string productID)
394390
{ EnrollmentConfigConstants.JobTitle, "Software Engineer" },
395391
{ EnrollmentConfigConstants.RegistrationAgent, "Agent" },
396392
{ EnrollmentConfigConstants.RegistrationNumber, "REG-12345" },
397-
{ "PriorCertSN", fakeCertificate.SerialNumber }
393+
{ "PriorCertSN", FakeRenewalCertificate.SerialNumber }
398394
}
399395
};
400396

@@ -404,12 +400,12 @@ public void GoDaddyCAPlugin_Renew_ReturnSuccess(string productID)
404400
EnrollmentType type = EnrollmentType.Renew;
405401

406402
// Act
407-
EnrollmentResult result = plugin.Enroll(csrString, subject, sans, productInfo, format, type).Result;
403+
EnrollmentResult result = await plugin.Enroll(TestCsr, TestSubject, sans, productInfo, format, type);
408404

409405
// Assert
410-
Assert.Equal(result.Status, (int)EndEntityStatus.GENERATED);
411-
Assert.Equal(result.StatusMessage, $"Certificate with ID {fakeCaRequestId} has been renewed");
412-
Assert.Equal(result.CARequestID, fakeCaRequestId);
406+
Assert.Equal((int)EndEntityStatus.GENERATED, result.Status);
407+
Assert.Equal($"Certificate with ID {fakeCaRequestId} has been renewed", result.StatusMessage);
408+
Assert.Equal(fakeCaRequestId, result.CARequestID);
413409
}
414410

415411
[Theory]
@@ -423,12 +419,12 @@ public void GoDaddyCAPlugin_Renew_ReturnSuccess(string productID)
423419
[InlineData("UCC_DV_SSL")]
424420
[InlineData("UCC_EV_SSL")]
425421
[InlineData("UCC_OV_SSL")]
426-
public void GoDaddyCAPlugin_Reissue_ReturnSuccess(string productID)
422+
public async Task GoDaddyCAPlugin_Reissue_ReturnSuccess(string productID)
427423
{
428424
// Arrange
429-
DateTime enrollmentNotBefore = DateTime.UtcNow.AddDays(-100);
430-
DateTime enrollmentNotAfter = DateTime.UtcNow.AddDays(365);
431-
X509Certificate2 fakeCertificate = FakeGoDaddyClient.GenerateSelfSignedCertificate(RSA.Create(2048), "CN=Test Cert", enrollmentNotBefore, enrollmentNotAfter);
425+
// DateTime enrollmentNotBefore = DateTime.UtcNow.AddDays(-100);
426+
// DateTime enrollmentNotAfter = DateTime.UtcNow.AddDays(365);
427+
// X509Certificate2 fakeCertificate = FakeGoDaddyClient.GenerateSelfSignedCertificate(RSA.Create(2048), "CN=Test Cert", enrollmentNotBefore, enrollmentNotAfter);
432428
string fakeCaRequestId = Guid.NewGuid().ToString();
433429

434430
FakeGoDaddyClient fakeClient = new FakeGoDaddyClient()
@@ -438,20 +434,14 @@ public void GoDaddyCAPlugin_Reissue_ReturnSuccess(string productID)
438434
{ fakeCaRequestId, new AnyCAPluginCertificate
439435
{
440436
CARequestID = fakeCaRequestId,
441-
Certificate = fakeCertificate.ExportCertificatePem(),
437+
Certificate = FakeReissueCertificate.ExportCertificatePem(),
442438
Status = 123,
443439
ProductID = productID,
444440
}
445441
}
446442
}
447443
};
448444

449-
// Renewal is only available 60 days prior to expiration of the previous certificate and 30 days after the
450-
// expiration of the previous certificate.
451-
452-
fakeClient.EnrollmentNotBefore = enrollmentNotBefore;
453-
fakeClient.EnrollmentNotAfter = enrollmentNotAfter;
454-
455445
BlockingCollection<AnyCAPluginCertificate> certificates = new BlockingCollection<AnyCAPluginCertificate>();
456446

457447
IAnyCAPluginConfigProvider configProvider = new FakeCaConfigProvider(new Config());
@@ -463,10 +453,6 @@ public void GoDaddyCAPlugin_Reissue_ReturnSuccess(string productID)
463453
};
464454
plugin.Initialize(configProvider, certificateDataReader);
465455

466-
// CSR
467-
string subject = "CN=Test Subject";
468-
string csrString = GenerateCSR(subject);
469-
470456
Dictionary<string, string[]> sans = new();
471457

472458
EnrollmentProductInfo productInfo = new EnrollmentProductInfo
@@ -493,7 +479,7 @@ public void GoDaddyCAPlugin_Reissue_ReturnSuccess(string productID)
493479
{ EnrollmentConfigConstants.JobTitle, "Software Engineer" },
494480
{ EnrollmentConfigConstants.RegistrationAgent, "Agent" },
495481
{ EnrollmentConfigConstants.RegistrationNumber, "REG-12345" },
496-
{ "PriorCertSN", fakeCertificate.SerialNumber }
482+
{ "PriorCertSN", FakeReissueCertificate.SerialNumber }
497483
}
498484
};
499485

@@ -503,12 +489,12 @@ public void GoDaddyCAPlugin_Reissue_ReturnSuccess(string productID)
503489
EnrollmentType type = EnrollmentType.Renew;
504490

505491
// Act
506-
EnrollmentResult result = plugin.Enroll(csrString, subject, sans, productInfo, format, type).Result;
492+
EnrollmentResult result = await plugin.Enroll(TestCsr, TestSubject, sans, productInfo, format, type);
507493

508494
// Assert
509-
Assert.Equal(result.Status, (int)EndEntityStatus.GENERATED);
510-
Assert.Equal(result.StatusMessage, $"Certificate with ID {fakeCaRequestId} has been reissued");
511-
Assert.Equal(result.CARequestID, fakeCaRequestId);
495+
Assert.Equal((int)EndEntityStatus.GENERATED, result.Status);
496+
Assert.Equal($"Certificate with ID {fakeCaRequestId} has been reissued", result.StatusMessage);
497+
Assert.Equal(fakeCaRequestId, result.CARequestID);
512498
}
513499

514500
[IntegrationTestingFact]
Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
// Copyright 2024 Keyfactor
1+
// Copyright 2026 Keyfactor
22
//
33
// Licensed under the Apache License, Version 2.0 (the "License");
44
// you may not use this file except in compliance with the License.
@@ -21,15 +21,15 @@
2121

2222
namespace Keyfactor.Extensions.CAPlugin.GoDaddyTests;
2323

24-
public class ClientTests
24+
public class GoDaddyClientTests
2525
{
2626
ILogger _logger { get; set;}
2727

28-
public ClientTests()
28+
public GoDaddyClientTests()
2929
{
3030
ConfigureLogging();
3131

32-
_logger = LogHandler.GetClassLogger<ClientTests>();
32+
_logger = LogHandler.GetClassLogger<GoDaddyClientTests>();
3333
}
3434

3535
[IntegrationTestingFact]

0 commit comments

Comments
 (0)