Skip to content
Open
Show file tree
Hide file tree
Changes from all 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
5 changes: 4 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,2 +1,5 @@
### 1.0.0
* Initial Release
* Initial Release

### 1.0.1
* Hotfix to prevent validation if Enabled is false
29 changes: 22 additions & 7 deletions globalsign-atlas-caplugin/AtlasCAPlugin.cs
Original file line number Diff line number Diff line change
Expand Up @@ -252,35 +252,35 @@ public Dictionary<string, PropertyConfigInfo> GetCAConnectorAnnotations()
{
return new Dictionary<string, PropertyConfigInfo>()
{
["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,
Expand Down Expand Up @@ -314,14 +314,14 @@ public Dictionary<string, PropertyConfigInfo> GetTemplateParameterAnnotations()
{
return new Dictionary<string, PropertyConfigInfo>()
{
["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,
Expand Down Expand Up @@ -383,6 +383,21 @@ public async Task Synchronize(BlockingCollection<AnyCAPluginCertificate> blockin
public async Task ValidateCAConnectionInfo(Dictionary<string, object> 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<string> errors = new List<string>();
string rawConfig = JsonConvert.SerializeObject(connectionInfo);
AtlasConfig testConfig = JsonConvert.DeserializeObject<AtlasConfig>(rawConfig);
Expand Down
12 changes: 12 additions & 0 deletions globalsign-atlas-caplugin/AtlasConfig.cs
Original file line number Diff line number Diff line change
Expand Up @@ -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")]
Expand Down
Loading