예제 #1
0
 public static ISafeguardEventListener GetPersistentA2AEventListener(SecureString apiKey,
                                                                     SafeguardEventHandler handler, string networkAddress, string certificatePath,
                                                                     SecureString certificatePassword, int apiVersion = DefaultApiVersion, bool ignoreSsl = false)
 {
     return(new PersistentSafeguardA2AEventListener(
                new SafeguardA2AContext(networkAddress, certificatePath, certificatePassword, apiVersion,
                                        ignoreSsl), apiKey, handler));
 }
예제 #2
0
 public void RegisterEventHandler(string eventName, SafeguardEventHandler handler)
 {
     if (_disposed)
     {
         throw new ObjectDisposedException("PersistentSafeguardEventListener");
     }
     _eventHandlerRegistry.RegisterEventHandler(eventName, handler);
 }
예제 #3
0
 /// <summary>
 /// Get a persistent A2A event listener for Gets an A2A event listener. The handler passed in will be registered
 /// for the AssetAccountPasswordUpdated event, which is the only one supported in A2A.
 /// </summary>
 /// <param name="apiKeys">A list of API keys corresponding to the configured accounts to listen for.</param>
 /// <param name="handler">A delegate to call any time the AssetAccountPasswordUpdate event occurs.</param>
 /// <param name="networkAddress">Network address of Safeguard appliance.</param>
 /// <param name="certificateThumbprint">SHA-1 hash identifying a client certificate in personal (My) store.</param>
 /// <param name="apiVersion">Target API version to use.</param>
 /// <param name="ignoreSsl">Ignore server certificate validation.</param>
 /// <returns>New persistent A2A event listener.</returns>
 public static ISafeguardEventListener GetPersistentA2AEventListener(IEnumerable <SecureString> apiKeys,
                                                                     SafeguardEventHandler handler, string networkAddress, string certificateThumbprint,
                                                                     int apiVersion = DefaultApiVersion, bool ignoreSsl = false)
 {
     return(new PersistentSafeguardA2AEventListener(
                new SafeguardA2AContext(networkAddress, certificateThumbprint, apiVersion, ignoreSsl), apiKeys,
                handler));
 }
        public ISafeguardEventListener GetPersistentA2AEventListener(IEnumerable <SecureString> apiKeys,
                                                                     SafeguardEventHandler handler)
        {
            if (_disposed)
            {
                throw new ObjectDisposedException("SafeguardA2AContext");
            }
            if (apiKeys == null)
            {
                throw new ArgumentException("Parameter may not be null", nameof(apiKeys));
            }

            return(new PersistentSafeguardA2AEventListener(Clone() as SafeguardA2AContext, apiKeys, handler));
        }
        public ISafeguardEventListener GetA2AEventListener(SecureString apiKey, SafeguardEventHandler handler)
        {
            if (_disposed)
            {
                throw new ObjectDisposedException("SafeguardA2AContext");
            }
            if (apiKey == null)
            {
                throw new ArgumentException("Parameter may not be null", nameof(apiKey));
            }

            var eventListener = new SafeguardEventListener($"https://{_networkAddress}/service/a2a", _clientCertificate,
                                                           apiKey, _ignoreSsl, _validationCallback);

            eventListener.RegisterEventHandler("AssetAccountPasswordUpdated", handler);
            Log.Debug("Event listener successfully created for Safeguard A2A context.");
            return(eventListener);
        }
예제 #6
0
 public PersistentSafeguardA2AEventListener(ISafeguardA2AContext a2AContext, IEnumerable <SecureString> apiKeys,
                                            SafeguardEventHandler handler)
 {
     _a2AContext = a2AContext;
     if (apiKeys == null)
     {
         throw new ArgumentException("Parameter may not be null", nameof(apiKeys));
     }
     _apiKeys = new List <SecureString>();
     foreach (var apiKey in apiKeys)
     {
         _apiKeys.Add(apiKey.Copy());
     }
     if (!_apiKeys.Any())
     {
         throw  new ArgumentException("Parameter must include at least one item", nameof(apiKeys));
     }
     RegisterEventHandler("AssetAccountPasswordUpdated", handler);
     Log.Debug("Persistent A2A event listener successfully created.");
 }
 public PersistentSafeguardA2AEventListener(ISafeguardA2AContext a2AContext, SecureString apiKey, SafeguardEventHandler handler)
 {
     _a2AContext = a2AContext;
     if (apiKey == null)
     {
         throw new ArgumentException("Parameter may not be null", nameof(apiKey));
     }
     _apiKey = apiKey.Copy();
     RegisterEventHandler("AssetAccountPasswordUpdated", handler);
     RegisterEventHandler("AssetAccountSshKeyUpdated", handler);
     Log.Debug("Persistent A2A event listener successfully created.");
 }