diff --git a/CHANGELOG.md b/CHANGELOG.md index 03d82d1..883c05d 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,2 +1,5 @@ ### 1.0.0 -* Initial Release +* Initial Release + +### 1.0.1 +* Hotfix to prevent validation if Enabled is false \ No newline at end of file diff --git a/globalsign-atlas-caplugin/AtlasCAPlugin.cs b/globalsign-atlas-caplugin/AtlasCAPlugin.cs index c08c907..e212d97 100644 --- a/globalsign-atlas-caplugin/AtlasCAPlugin.cs +++ b/globalsign-atlas-caplugin/AtlasCAPlugin.cs @@ -252,35 +252,35 @@ public Dictionary GetCAConnectorAnnotations() { return new Dictionary() { - ["ApiKey"] = new PropertyConfigInfo() + [AtlasConfig.Constants.API_KEY] = new PropertyConfigInfo() { Comments = "The API key for the Atlas credentials the gateway will use.", Hidden = false, DefaultValue = "", Type = "String" }, - ["ApiSecret"] = new PropertyConfigInfo() + [AtlasConfig.Constants.API_SECRET] = new PropertyConfigInfo() { Comments = "The corresponding API secret value that matches with the ApiKey.", Hidden = true, DefaultValue = "", Type = "String" }, - ["ClientCertificate"] = new PropertyConfigInfo() + [AtlasConfig.Constants.CLIENT_CERTIFICATE] = new PropertyConfigInfo() { Comments = "The client auth certificate to use with the Atlas API", Hidden = false, DefaultValue = "", Type = "ClientCertificate" }, - ["SyncStartDate"] = new PropertyConfigInfo() + [AtlasConfig.Constants.SYNC_START_DATE] = new PropertyConfigInfo() { Comments = "The earliest date to go back when doing a full sync.", Hidden = false, DefaultValue = "2024-01-01", Type = "String" }, - ["Enabled"] = new PropertyConfigInfo() + [AtlasConfig.Constants.ENABLED] = new PropertyConfigInfo() { Comments = "Flag to Enable or Disable gateway functionality. Disabling is primarily used to allow creation of the CA prior to configuration information being available.", Hidden = false, @@ -314,14 +314,14 @@ public Dictionary GetTemplateParameterAnnotations() { return new Dictionary() { - ["Lifetime"] = new PropertyConfigInfo() + [AtlasConfig.Constants.LIFETIME] = new PropertyConfigInfo() { Comments = "The term length (in days) to use for enrollment.", Hidden = false, DefaultValue = 30, Type = "Number" }, - ["KeyUsage"] = new PropertyConfigInfo() + [AtlasConfig.Constants.KEY_USAGE] = new PropertyConfigInfo() { Comments = "The key usage to use for enrolled certs. Valid values are 'client', 'server', and 'clientserver'.", Hidden = false, @@ -383,6 +383,21 @@ public async Task Synchronize(BlockingCollection blockin public async Task ValidateCAConnectionInfo(Dictionary connectionInfo) { _logger.LogTrace($"Validating CA Connection info"); + + try + { + if (!(bool)connectionInfo[AtlasConfig.Constants.ENABLED]) + { + _logger.LogWarning($"The CA is currently in the Disabled state. It must be Enabled to perform operations. Skipping validation..."); + _logger.MethodExit(LogLevel.Trace); + return; + } + } + catch (Exception ex) + { + _logger.LogError($"Exception: {LogHandler.FlattenException(ex)}"); + } + List errors = new List(); string rawConfig = JsonConvert.SerializeObject(connectionInfo); AtlasConfig testConfig = JsonConvert.DeserializeObject(rawConfig); diff --git a/globalsign-atlas-caplugin/AtlasConfig.cs b/globalsign-atlas-caplugin/AtlasConfig.cs index 2283063..53f95b3 100644 --- a/globalsign-atlas-caplugin/AtlasConfig.cs +++ b/globalsign-atlas-caplugin/AtlasConfig.cs @@ -12,6 +12,18 @@ namespace Keyfactor.Extensions.CAPlugin.GlobalSign.Atlas { public class AtlasConfig { + public class Constants + { + public static string API_KEY = "ApiKey"; + public static string API_SECRET = "ApiSecret"; + public static string CLIENT_CERTIFICATE = "ClientCertificate"; + public static string SYNC_START_DATE = "SyncStartDate"; + public static string ENABLED = "Enabled"; + + public static string LIFETIME = "Lifetime"; + public static string KEY_USAGE = "KeyUsage"; + } + public AtlasConfig() { } [JsonProperty("ApiKey")]