-
Notifications
You must be signed in to change notification settings - Fork 0
Merge 1.0.1 to main #4
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,2 +1,5 @@ | ||
| # v1.0.1 | ||
| * SaaS Containerization Fixes, added enabled flag cleaned up some log messages | ||
|
|
||
| # v1.0.0 | ||
| * Initial Release. Sync, Enroll, and Revocation. | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -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) | ||
| { | ||
|
|
@@ -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
|
||
|
|
@@ -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) | ||
| { | ||
|
|
||
There was a problem hiding this comment.
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".