Skip to content

Commit 662e2dc

Browse files
Merge c1329a3 into 98581fa
2 parents 98581fa + c1329a3 commit 662e2dc

6 files changed

Lines changed: 47 additions & 8 deletions

File tree

.gitignore

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -328,3 +328,5 @@ ASALocalRun/
328328

329329
# MFractors (Xamarin productivity tool) working folder
330330
.mfractor/
331+
.claude/settings.local.json
332+
sample change.txt

CHANGELOG.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,5 @@
1+
# v1.0.1
2+
* SaaS Containerization Fixes, added enabled flag cleaned up some log messages
3+
14
# v1.0.0
25
* Initial Release. Sync, Enroll, and Revocation.

HydrantCAProxy/HydrantIdCAPlugin.cs

Lines changed: 28 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,7 @@ public class HydrantIdCAPlugin : IAnyCAPlugin
2929
private RequestManager _requestManager;
3030
private IAnyCAPluginConfigProvider Config { get; set; }
3131
private ICertificateDataReader certDataReader;
32+
private HydrantIdCAPluginConfig.Config _config;
3233

3334
public void Initialize(IAnyCAPluginConfigProvider configProvider, ICertificateDataReader certificateDataReader)
3435
{
@@ -37,10 +38,13 @@ public void Initialize(IAnyCAPluginConfigProvider configProvider, ICertificateDa
3738
{
3839
certDataReader = certificateDataReader;
3940
Config = configProvider;
41+
var rawData = JsonConvert.SerializeObject(configProvider.CAConnectionData);
42+
_config = JsonConvert.DeserializeObject<HydrantIdCAPluginConfig.Config>(rawData);
43+
_logger.LogTrace($"Initialize - Enabled: {_config.Enabled}");
4044
}
4145
catch (Exception ex)
4246
{
43-
_logger.LogError($"Failed to initialize GCP CAS CAPlugin: {ex}");
47+
_logger.LogError($"Failed to initialize HydrantId CAPlugin: {ex}");
4448
}
4549
}
4650

@@ -58,23 +62,39 @@ private static List<string> CheckRequiredValues(Dictionary<string, object> conne
5862

5963
public async Task Ping()
6064
{
61-
65+
_logger.MethodEntry();
66+
if (!_config.Enabled)
67+
{
68+
_logger.LogWarning($"The CA is currently in the Disabled state. It must be Enabled to perform operations. Skipping connectivity test...");
69+
_logger.MethodExit(LogLevel.Trace);
70+
return;
71+
}
72+
_logger.LogDebug("Pinging HydrantId to validate connection");
73+
_logger.MethodExit();
6274
}
6375

6476
public Task ValidateCAConnectionInfo(Dictionary<string, object> connectionInfo)
6577
{
6678
_logger.MethodEntry();
67-
_logger.LogDebug($"Validating GCP CAS CA Connection properties");
79+
_logger.LogDebug($"Validating HydrantId CA Connection properties");
6880
var rawData = JsonConvert.SerializeObject(connectionInfo);
69-
HydrantIdCAPluginConfig.Config config = JsonConvert.DeserializeObject<HydrantIdCAPluginConfig.Config>(rawData);
81+
_config = JsonConvert.DeserializeObject<HydrantIdCAPluginConfig.Config>(rawData);
7082

71-
_logger.LogTrace($"HydrantIdClientFromCAConnectionData - HydrantIdBaseUrl: {config.HydrantIdBaseUrl}");
83+
_logger.LogTrace($"HydrantIdClientFromCAConnectionData - HydrantIdBaseUrl: {_config.HydrantIdBaseUrl}");
84+
_logger.LogTrace($"HydrantIdClientFromCAConnectionData - Enabled: {_config.Enabled}");
85+
86+
if (!_config.Enabled)
87+
{
88+
_logger.LogWarning($"The CA is currently in the Disabled state. It must be Enabled to perform operations. Skipping config validation...");
89+
_logger.MethodExit();
90+
return Task.CompletedTask;
91+
}
7292

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

75-
if (string.IsNullOrEmpty(config.HydrantIdBaseUrl)) missingFields.Add(nameof(config.HydrantIdBaseUrl));
76-
if (string.IsNullOrEmpty(config.HydrantIdAuthId)) missingFields.Add(nameof(config.HydrantIdAuthId));
77-
if (string.IsNullOrEmpty(config.HydrantIdAuthKey)) missingFields.Add(nameof(config.HydrantIdAuthKey));
95+
if (string.IsNullOrEmpty(_config.HydrantIdBaseUrl)) missingFields.Add(nameof(_config.HydrantIdBaseUrl));
96+
if (string.IsNullOrEmpty(_config.HydrantIdAuthId)) missingFields.Add(nameof(_config.HydrantIdAuthId));
97+
if (string.IsNullOrEmpty(_config.HydrantIdAuthKey)) missingFields.Add(nameof(_config.HydrantIdAuthKey));
7898

7999
if (missingFields.Count > 0)
80100
{

HydrantCAProxy/HydrantIdCAPluginConfig.cs

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,13 +28,15 @@ public class ConfigConstants
2828
public static string HydrantIdAuthId = "HydrantIdAuthId";
2929
public static string HydrantIdAuthKey = "HydrantIdAuthKey";
3030
public static string DefaultPageSize = "DefaultPageSize";
31+
public static string Enabled = "Enabled";
3132
}
3233

3334
public class Config
3435
{
3536
public string HydrantIdBaseUrl { get; set; }
3637
public string HydrantIdAuthId { get; set; }
3738
public string HydrantIdAuthKey { get; set; }
39+
public bool Enabled { get; set; }
3840
}
3941

4042
public static class EnrollmentParametersConstants
@@ -68,6 +70,13 @@ public static Dictionary<string, PropertyConfigInfo> GetPluginAnnotations()
6870
Hidden = true,
6971
DefaultValue = "",
7072
Type = "Secret"
73+
},
74+
[ConfigConstants.Enabled] = new PropertyConfigInfo()
75+
{
76+
Comments = "Flag to Enable or Disable the CA connector.",
77+
Hidden = false,
78+
DefaultValue = true,
79+
Type = "Bool"
7180
}
7281
};
7382
}

README.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -260,6 +260,7 @@ The plugin supports the following standard CRL revocation reasons:
260260
* **HydrantIdBaseUrl** - The Base URL For the HydrantId Endpoint similar to https://acm-stage.hydrantid.com. Get this from HydrantId.
261261
* **HydrantIdAuthId** - The AuthId Obtained from HydrantId.
262262
* **HydrantIdAuthKey** - The AuthKey Obtained from HydrantId.
263+
* **Enabled** - Flag to Enable or Disable the CA connector.
263264
264265
2. ### Template (Product) Configuration
265266

integration-manifest.json

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,10 @@
2424
{
2525
"name": "HydrantIdAuthKey",
2626
"description": "The AuthKey Obtained from HydrantId."
27+
},
28+
{
29+
"name": "Enabled",
30+
"description": "Flag to Enable or Disable the CA connector."
2731
}
2832
],
2933
"enrollment_config": [

0 commit comments

Comments
 (0)