/// <summary>
        /// This method registers an authentication handler with the collection.
        /// </summary>
        /// <param name="identifier">The identifier for the handler.</param>
        /// <param name="handler">The handler to register.</param>
        public void RegisterAuthenticationHandler(string identifier, IAuthenticationHandler handler)
        {
            if (string.IsNullOrEmpty(identifier))
            {
                throw new ArgumentNullException("identifier");
            }

            if (handler == null)
            {
                throw new ArgumentNullException("handler");
            }

            if (mAuthenticationHandlers.ContainsKey(identifier))
            {
                throw new AuthenticationHandlerAlreadyExistsException(identifier);
            }

            try
            {
                mAuthenticationHandlers.Add(identifier, handler);
            }
            catch (Exception ex)
            {
                Collector?.LogException($"{nameof(RegisterAuthenticationHandler)} unexpected error.", ex);
                throw;
            }
        }
Beispiel #2
0
 private void OnStatusChanged(object sender, StatusChangedEventArgs e)
 {
     try
     {
         StatusChanged?.Invoke(mService, e);
     }
     catch (Exception ex)
     {
         mDataCollection?.LogException("OnStatusChanged / external exception thrown on event", ex);
     }
 }
Beispiel #3
0
 /// <summary>
 /// This helper method provides a class name and method name for debugging exceptions.
 /// </summary>
 /// <param name="method">The method.</param>
 /// <returns>A combination string.</returns>
 protected void LogExceptionLocation(string method, Exception ex)
 {
     Collector?.LogException($"{GetType().Name}/{method}", ex);
 }
 /// <summary>
 /// This helper method provides a class name and method name for debugging exceptions.
 /// </summary>
 /// <param name="method">The method.</param>
 /// <returns>A combination string.</returns>
 protected void LogExceptionLocation(string method, Exception ex)
 {
     Collector?.LogException(string.Format("{0}/{1}", GetType().Name, method), ex);
 }