3434using Org . BouncyCastle . Crypto ;
3535using Org . BouncyCastle . OpenSsl ;
3636using Org . BouncyCastle . Pkcs ;
37+ using Keyfactor . Orchestrators . Common . Enums ;
3738
3839namespace Keyfactor . Extensions . Orchestrator . CitricAdc
3940{
4041 // ReSharper disable once InconsistentNaming
4142 internal class CitrixAdcStore
4243 {
43- private const uint Timeout = 3600 ;
44+ private const uint DefaultTimeout = 3600 ;
4445 public static readonly string StoreType = "CitrixAdc" ;
4546
4647 private readonly string _clientMachine ;
@@ -51,6 +52,7 @@ internal class CitrixAdcStore
5152 public readonly string StorePath ;
5253 private readonly string _username ;
5354 private readonly bool _useSsl ;
55+ private readonly uint _timeout ;
5456
5557 private nitro_service _nss ;
5658
@@ -61,6 +63,12 @@ public CitrixAdcStore(InventoryJobConfiguration config, string serverUserName, s
6163 Logger = LogHandler . GetClassLogger < CitrixAdcStore > ( ) ;
6264 Logger . MethodEntry ( LogLevel . Debug ) ;
6365
66+ dynamic properties = JsonConvert . DeserializeObject ( config . CertificateStoreDetails . Properties . ToString ( ) ) ;
67+ if ( ! UInt32 . TryParse ( ( properties . timeout == null || string . IsNullOrEmpty ( properties . timeout . Value ) ? DefaultTimeout : properties . timeout . Value ) , out _timeout ) )
68+ {
69+ Logger . LogWarning ( $ "Missing or invalid Custom Field 'timeout' value { properties . timeout . Value } . Value must be an integer. Will use default value of { DefaultTimeout . ToString ( ) } ") ;
70+ }
71+
6472 _clientMachine = config . CertificateStoreDetails . ClientMachine ;
6573 StorePath = StripTrailingSlash ( config . CertificateStoreDetails . StorePath ) ;
6674 var o = new systemfile_args ( ) ;
@@ -123,11 +131,11 @@ public CitrixAdcStore(ManagementJobConfiguration config, string serverUserName,
123131 // ReSharper disable once UnusedAutoPropertyAccessor.Local
124132 private ILogger Logger { get ; }
125133
126- public void Login ( uint ? timeout )
134+ public void Login ( )
127135 {
128136 Logger . MethodEntry ( LogLevel . Debug ) ;
129137 _nss ??= new nitro_service ( _clientMachine , _useSsl ? "https" : "http" ) ;
130- _nss . set_timeout ( timeout == 0 ? Timeout : timeout ) ;
138+ _nss . set_timeout ( _timeout ) ;
131139
132140 base_response response = null ;
133141 try
0 commit comments