-
Notifications
You must be signed in to change notification settings - Fork 5
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Bob Pokorny
committed
Oct 24, 2024
1 parent
62187bb
commit 0a59d74
Showing
6 changed files
with
272 additions
and
192 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,55 @@ | ||
using System; | ||
using System.Collections.Generic; | ||
using System.Linq; | ||
using System.Runtime.CompilerServices; | ||
using System.Text; | ||
using System.Threading.Tasks; | ||
|
||
namespace Keyfactor.Extensions.Orchestrator.WindowsCertStore.ImplementedStoreTypes.WinIIS | ||
{ | ||
public class IISBindingInfo | ||
{ | ||
public string SiteName { get; set; } | ||
public string Protocol { get; set; } | ||
public string IPAddress { get; set; } | ||
public string Port { get; set; } | ||
public string HostName { get; set; } | ||
public string SniFlag { get; set; } | ||
|
||
public IISBindingInfo(Dictionary<string, object> bindingInfo) | ||
{ | ||
SiteName = bindingInfo["SiteName"].ToString(); | ||
Protocol = bindingInfo["Protocol"].ToString(); | ||
IPAddress = bindingInfo["IPAddress"].ToString(); | ||
Port = bindingInfo["Port"].ToString(); | ||
HostName = bindingInfo["HostName"].ToString(); | ||
SniFlag = MigrateSNIFlag(bindingInfo["SniFlag"].ToString()); | ||
} | ||
|
||
private string MigrateSNIFlag(string input) | ||
{ | ||
// Check if the input is numeric, if so, just return it as an integer | ||
if (int.TryParse(input, out int numericValue)) | ||
{ | ||
return numericValue.ToString(); | ||
} | ||
|
||
if (string.IsNullOrEmpty(input)) { throw new ArgumentNullException("SNI/SSL Flag", "The SNI or SSL Flag flag must not be empty or null."); } | ||
|
||
// Handle the string cases | ||
switch (input.ToLower()) | ||
{ | ||
case "0 - no sni": | ||
return "0"; | ||
case "1 - sni enabled": | ||
return "1"; | ||
case "2 - non sni binding": | ||
return "2"; | ||
case "3 - sni binding": | ||
return "3"; | ||
default: | ||
throw new ArgumentOutOfRangeException($"Received an invalid value '{input}' for sni/ssl Flag value"); | ||
} | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.