Skip to content
Merged
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -328,3 +328,5 @@ ASALocalRun/

# MFractors (Xamarin productivity tool) working folder
.mfractor/
.claude/settings.local.json
sample change.txt
14 changes: 3 additions & 11 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,13 +1,5 @@
# v2.0.0
* Migrate `packages.config` to `PackageReference` format
* Upgrade packages to support Keyfactor AnyCA Gateway DCOM v24.2
* Upgrade `Keyfactor.AnyGateway.SDK` to `24.2.0-PRERELEASE-47446`
* Add support for [GCP CAS Certificate Templates](https://cloud.google.com/certificate-authority-service/docs/policy-controls)
* Enable configuration of CA Pool-based or CA-specific certificate enrollment. If the `CAId` is specified, certificates are enrolled with the CA specified by `CAId`. Otherwise, GCP CAS selects a CA in the CA Pool based on policy.

# v1.1.0
- Remove template references from README
- Small bug fixes
# v1.0.1
* SaaS Containerization Fixes, added enabled flag cleaned up some log messages
Copy link

Copilot AI Feb 25, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The CHANGELOG entry has a minor grammar issue. "added enabled flag cleaned up" should have proper punctuation. Consider: "SaaS Containerization Fixes, added enabled flag, and cleaned up some log messages" or "SaaS Containerization Fixes: added enabled flag and cleaned up some log messages".

Suggested change
* SaaS Containerization Fixes, added enabled flag cleaned up some log messages
* SaaS Containerization Fixes: added enabled flag and cleaned up some log messages

Copilot uses AI. Check for mistakes.

# v1.0.0
* Initial Release. Support for Google GA CA Service. Sync, Enroll, and Revocation.
* Initial Release. Sync, Enroll, and Revocation.
36 changes: 28 additions & 8 deletions HydrantCAProxy/HydrantIdCAPlugin.cs
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@ public class HydrantIdCAPlugin : IAnyCAPlugin
private RequestManager _requestManager;
private IAnyCAPluginConfigProvider Config { get; set; }
private ICertificateDataReader certDataReader;
private HydrantIdCAPluginConfig.Config _config;

public void Initialize(IAnyCAPluginConfigProvider configProvider, ICertificateDataReader certificateDataReader)
{
Expand All @@ -37,10 +38,13 @@ public void Initialize(IAnyCAPluginConfigProvider configProvider, ICertificateDa
{
certDataReader = certificateDataReader;
Config = configProvider;
var rawData = JsonConvert.SerializeObject(configProvider.CAConnectionData);
_config = JsonConvert.DeserializeObject<HydrantIdCAPluginConfig.Config>(rawData);
_logger.LogTrace($"Initialize - Enabled: {_config.Enabled}");
}
catch (Exception ex)
{
_logger.LogError($"Failed to initialize GCP CAS CAPlugin: {ex}");
_logger.LogError($"Failed to initialize HydrantId CAPlugin: {ex}");
}
}

Comment on lines 38 to 50
Copy link

Copilot AI Feb 25, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The Synchronize method does not check the Enabled flag before attempting to synchronize certificates from HydrantId. This is inconsistent with the Ping and ValidateCAConnectionInfo methods which skip operations when Enabled is false. When the CA is disabled, this method should return early to avoid unnecessary API calls and processing.

Copilot uses AI. Check for mistakes.
Expand All @@ -58,23 +62,39 @@ private static List<string> CheckRequiredValues(Dictionary<string, object> conne

public async Task Ping()
{

_logger.MethodEntry();
if (!_config.Enabled)
{
_logger.LogWarning($"The CA is currently in the Disabled state. It must be Enabled to perform operations. Skipping connectivity test...");
_logger.MethodExit(LogLevel.Trace);
return;
}
_logger.LogDebug("Pinging HydrantId to validate connection");
_logger.MethodExit();
}

public Task ValidateCAConnectionInfo(Dictionary<string, object> connectionInfo)
{
_logger.MethodEntry();
_logger.LogDebug($"Validating GCP CAS CA Connection properties");
_logger.LogDebug($"Validating HydrantId CA Connection properties");
var rawData = JsonConvert.SerializeObject(connectionInfo);
HydrantIdCAPluginConfig.Config config = JsonConvert.DeserializeObject<HydrantIdCAPluginConfig.Config>(rawData);
_config = JsonConvert.DeserializeObject<HydrantIdCAPluginConfig.Config>(rawData);

_logger.LogTrace($"HydrantIdClientFromCAConnectionData - HydrantIdBaseUrl: {config.HydrantIdBaseUrl}");
_logger.LogTrace($"HydrantIdClientFromCAConnectionData - HydrantIdBaseUrl: {_config.HydrantIdBaseUrl}");
_logger.LogTrace($"HydrantIdClientFromCAConnectionData - Enabled: {_config.Enabled}");

if (!_config.Enabled)
{
_logger.LogWarning($"The CA is currently in the Disabled state. It must be Enabled to perform operations. Skipping config validation...");
_logger.MethodExit();
return Task.CompletedTask;
}

List<string> missingFields = new List<string>();

if (string.IsNullOrEmpty(config.HydrantIdBaseUrl)) missingFields.Add(nameof(config.HydrantIdBaseUrl));
if (string.IsNullOrEmpty(config.HydrantIdAuthId)) missingFields.Add(nameof(config.HydrantIdAuthId));
if (string.IsNullOrEmpty(config.HydrantIdAuthKey)) missingFields.Add(nameof(config.HydrantIdAuthKey));
if (string.IsNullOrEmpty(_config.HydrantIdBaseUrl)) missingFields.Add(nameof(_config.HydrantIdBaseUrl));
if (string.IsNullOrEmpty(_config.HydrantIdAuthId)) missingFields.Add(nameof(_config.HydrantIdAuthId));
if (string.IsNullOrEmpty(_config.HydrantIdAuthKey)) missingFields.Add(nameof(_config.HydrantIdAuthKey));

if (missingFields.Count > 0)
{
Expand Down
4 changes: 2 additions & 2 deletions HydrantCAProxy/HydrantIdCAPlugin.csproj
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<TargetFramework>net6.0</TargetFramework>
<TargetFrameworks>net6.0;net8.0</TargetFrameworks>
<ImplicitUsings>disable</ImplicitUsings>
<CopyLocalLockFileAssemblies>true</CopyLocalLockFileAssemblies>
<GenerateAssemblyInfo>false</GenerateAssemblyInfo>
Expand All @@ -18,4 +18,4 @@
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
</None>
</ItemGroup>
</Project>
</Project>
9 changes: 9 additions & 0 deletions HydrantCAProxy/HydrantIdCAPluginConfig.cs
Original file line number Diff line number Diff line change
Expand Up @@ -28,13 +28,15 @@ public class ConfigConstants
public static string HydrantIdAuthId = "HydrantIdAuthId";
public static string HydrantIdAuthKey = "HydrantIdAuthKey";
public static string DefaultPageSize = "DefaultPageSize";
public static string Enabled = "Enabled";
}

public class Config
{
public string HydrantIdBaseUrl { get; set; }
public string HydrantIdAuthId { get; set; }
public string HydrantIdAuthKey { get; set; }
public bool Enabled { get; set; }
}

public static class EnrollmentParametersConstants
Expand Down Expand Up @@ -68,6 +70,13 @@ public static Dictionary<string, PropertyConfigInfo> GetPluginAnnotations()
Hidden = true,
DefaultValue = "",
Type = "Secret"
},
[ConfigConstants.Enabled] = new PropertyConfigInfo()
{
Comments = "Flag to Enable or Disable the CA connector.",
Hidden = false,
DefaultValue = true,
Type = "Bool"
}
};
}
Expand Down
Loading
Loading