Skip to content
Closed
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
1 change: 1 addition & 0 deletions digicert-mpki-caplugin/Constants.cs
Original file line number Diff line number Diff line change
Expand Up @@ -13,5 +13,6 @@ public class Constants
public static string EmailConstName = "EmailConstName";
public static string UpnConstName = "UpnConstName";
public static string OuStartPoint = "OuStartPoint";
public static string Enabled = "Enabled";
}
}
27 changes: 27 additions & 0 deletions digicert-mpki-caplugin/DigicertMpkiCAPlugin.cs
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,13 @@ public void Initialize(IAnyCAPluginConfigProvider configProvider, ICertificateDa
_config = DeserializeConfig(configProvider.CAConnectionData);
_logger.MethodEntry();

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

_requestManager = new RequestManager(_logger, _config);
_client = new DigiCertSymClient(_config, _logger);

Expand Down Expand Up @@ -297,6 +304,19 @@ private async Task<EnrollmentResult> ProcessRenewEnrollment(string csr, Enrollme

public async Task ValidateCAConnectionInfo(Dictionary<string, object> connectionInfo)
{
try
{
if (!(bool)connectionInfo[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 = ValidateConnectionInfo(connectionInfo);
if (errors.Any())
ThrowValidationException(errors);
Expand Down Expand Up @@ -372,6 +392,13 @@ public Dictionary<string, PropertyConfigInfo> GetCAConnectorAnnotations()
Hidden = false,
DefaultValue = "",
Type = "String"
},
[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,
DefaultValue = true,
Type = "Boolean"
}
};
}
Expand Down
1 change: 1 addition & 0 deletions digicert-mpki-caplugin/DigicertMpkiConfig.cs
Original file line number Diff line number Diff line change
Expand Up @@ -17,5 +17,6 @@ public DigicertMpkiConfig()
public string EmailConstName { get; set; }
public string UpnConstName { get; set; }
public int OuStartPoint { get; set; }
public bool Enabled { get; set; } = true;
}
}
Loading