/// <summary>   
        /// Registers the custom failure handler configuration section, so that it may be used instead of resolving against a config file. 
        /// </summary>
        /// <remarks>   ebrown, 4/7/2011. </remarks>
        /// <exception cref="ArgumentNullException">    Thrown when one or more required arguments are null. </exception>
        /// <exception cref="ArgumentException">        Thrown when one or more arguments have unsupported or illegal values. </exception>
        /// <param name="name">             The name. </param>
        /// <param name="configuration">    The configuration. </param>
        public static void Register(string name, IFailureHandlerConfiguration configuration)
        {
            if (null == name) { throw new ArgumentNullException("name"); }
            if (string.IsNullOrWhiteSpace(name)) { throw new ArgumentException("cannot be empty", "name"); }
            if (null == configuration) { throw new ArgumentNullException("configuration"); }

            var storedConfiguration = customConfigurationSections.GetOrAdd(name, configuration);
            if (storedConfiguration != configuration) { throw new ArgumentException("A configuration section by the name specified is already registered"); }
        }
        /// <summary>
        /// Registers the custom failure handler configuration section, so that it may be used instead of resolving against a config file.
        /// </summary>
        /// <remarks>   ebrown, 4/7/2011. </remarks>
        /// <exception cref="ArgumentNullException">    Thrown when one or more required arguments are null. </exception>
        /// <exception cref="ArgumentException">        Thrown when one or more arguments have unsupported or illegal values. </exception>
        /// <param name="name">             The name. </param>
        /// <param name="configuration">    The configuration. </param>
        public static void Register(string name, IFailureHandlerConfiguration configuration)
        {
            if (null == name)
            {
                throw new ArgumentNullException("name");
            }
            if (string.IsNullOrWhiteSpace(name))
            {
                throw new ArgumentException("cannot be empty", "name");
            }
            if (null == configuration)
            {
                throw new ArgumentNullException("configuration");
            }

            var storedConfiguration = customConfigurationSections.GetOrAdd(name, configuration);

            if (storedConfiguration != configuration)
            {
                throw new ArgumentException("A configuration section by the name specified is already registered");
            }
        }
 /// <summary>   
 /// Initializes a new instance of the AuthenticationFailureGenericEventArgs class that will be to passed to an event client. The client
 /// is responsible for filling in the IPrincipal. 
 /// </summary>
 /// <remarks>   ebrown, 1/3/2011. </remarks>
 /// <param name="config">           The configuration. </param>
 /// <param name="httpContext">      The HttpContext for the given request. </param>
 /// <param name="inspectorResults"> The set of failed inspector results. </param>
 public SimpleFailureEventArgs(IFailureHandlerConfiguration config, HttpContextBase httpContext, Dictionary<IAuthenticator, AuthenticationResult> inspectorResults)
 {
     Config = config;
     HttpContextBase = httpContext;
     InspectorResults = inspectorResults;
 }
 /// <summary>
 /// Constructs an instance of a failure handler, but returns non-generic interface.  Intended to be called by infrastructure
 /// -- don't use this as it may not contain customized configuration information. Delegates directly to the generic version.
 /// </summary>
 /// <param name="config">   The configuration used to guide construction of the failure handler. </param>
 /// <returns>   An instance of a failure handler. </returns>
 public IFailureHandler Construct(IFailureHandlerConfiguration config)
 {
     return(Construct((T)config));
 }
Beispiel #5
0
 IFailureHandler IFailureHandlerFactory.Construct(IFailureHandlerConfiguration config)
 {
     return(new MockFailureHandler());
 }
Beispiel #6
0
 public MockFailureHandlerConfiguration(IFailureHandlerConfiguration config)
 {
     this._config = config;
 }
 public MockFailureHandlerConfiguration(IFailureHandlerConfiguration config)
 {
     this._config = config;
 }
 IFailureHandler IFailureHandlerFactory.Construct(IFailureHandlerConfiguration config)
 {
     return new MockFailureHandler();
 }
 /// <summary>
 /// Initializes a new instance of the AuthenticationFailureGenericEventArgs class that will be to passed to an event client. The client
 /// is responsible for filling in the IPrincipal.
 /// </summary>
 /// <remarks>   ebrown, 1/3/2011. </remarks>
 /// <param name="config">           The configuration. </param>
 /// <param name="httpContext">      The HttpContext for the given request. </param>
 /// <param name="inspectorResults"> The set of failed inspector results. </param>
 public SimpleFailureEventArgs(IFailureHandlerConfiguration config, HttpContextBase httpContext, Dictionary <IAuthenticator, AuthenticationResult> inspectorResults)
 {
     Config           = config;
     HttpContextBase  = httpContext;
     InspectorResults = inspectorResults;
 }