Skip to content

Commit 4460e5d

Browse files
authored
Merge 8850680 into aceca2d
2 parents aceca2d + 8850680 commit 4460e5d

2 files changed

Lines changed: 13 additions & 9 deletions

File tree

digicert-certcentral-caplugin/CertCentralCAPlugin.cs

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -615,7 +615,7 @@ public Dictionary<string, PropertyConfigInfo> GetTemplateParameterAnnotations()
615615
{
616616
Comments = "Optional for secure_email_* types, ignored otherwise. Valid values are: strict, multipurpose. Use 'multipurpose' if your cert includes any additional EKUs such as client auth. Default if not provided is dependent on product configuration within Digicert portal.",
617617
Hidden = false,
618-
DefaultValue = "strict",
618+
DefaultValue = "",
619619
Type = "String"
620620
},
621621
[CertCentralConstants.Config.FIRST_NAME] = new PropertyConfigInfo()
@@ -760,7 +760,9 @@ public async Task Synchronize(BlockingCollection<AnyCAPluginCertificate> blockin
760760
{
761761
_logger.MethodEntry(LogLevel.Trace);
762762

763-
lastSync = lastSync.HasValue ? lastSync.Value.AddHours(-7) : DateTime.MinValue; // DigiCert issue with treating the timezone as mountain time. -7 to accomodate DST
763+
// DigiCert issue with treating the timezone as mountain time. -7 hours to accomodate DST
764+
// If no last sync, use 7 days in the past as the starting point (only relevant for incremental syncs)
765+
lastSync = lastSync.HasValue ? lastSync.Value.AddHours(-7) : DateTime.UtcNow.AddDays(-7);
764766
DateTime? utcDate = DateTime.UtcNow.AddDays(1);
765767
string lastSyncFormat = FormatSyncDate(lastSync);
766768
string todaySyncFormat = FormatSyncDate(utcDate);
@@ -1557,6 +1559,7 @@ private List<AnyCAPluginCertificate> GetAllConnectorCertsForOrder(string caReque
15571559
var orderCerts = GetAllCertsForOrder(orderId);
15581560

15591561
List<AnyCAPluginCertificate> certList = new List<AnyCAPluginCertificate>();
1562+
List<string> pemList = new List<string>();
15601563

15611564
foreach (var cert in orderCerts)
15621565
{
@@ -1578,6 +1581,13 @@ private List<AnyCAPluginCertificate> GetAllConnectorCertsForOrder(string caReque
15781581
throw new Exception($"Unexpected error downloading certificate {certId} for order {orderId}: {certificateChainResponse.Errors.FirstOrDefault()?.message}");
15791582
}
15801583
}
1584+
//Another check for duplicate PEMs to get arround issue with DigiCert API returning incorrect data sometimes on reissued/duplicate certs
1585+
if (pemList.Contains(certificate))
1586+
{
1587+
_logger.LogWarning($"Found duplicate PEM for ID {caReqId}. Skipping...");
1588+
continue;
1589+
}
1590+
pemList.Add(certificate);
15811591
var connCert = new AnyCAPluginCertificate
15821592
{
15831593
CARequestID = caReqId,

digicert-certcentral-caplugin/Models/CertCentralCertType.cs

Lines changed: 1 addition & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,6 @@ public class CertCentralCertType
1616
#region Private Fields
1717

1818
private static readonly ILogger Logger = LogHandler.GetClassLogger<CertCentralCertType>();
19-
private static List<CertCentralCertType> _allTypes;
2019

2120
#endregion Private Fields
2221

@@ -62,12 +61,7 @@ public class CertCentralCertType
6261
/// <returns></returns>
6362
public static List<CertCentralCertType> GetAllTypes(CertCentralConfig config)
6463
{
65-
if (_allTypes == null || !_allTypes.Any())
66-
{
67-
_allTypes = RetrieveCertCentralCertTypes(config);
68-
}
69-
70-
return _allTypes;
64+
return RetrieveCertCentralCertTypes(config);
7165
}
7266

7367
/// <summary>

0 commit comments

Comments
 (0)