public ConfigurableRequireHttpsAttribute
            (Type configurationProviderType, string configurationProviderMethod)
        {
            if (configurationProviderType == null)
            {
                throw new ArgumentNullException(nameof(configurationProviderType));
            }
            if (configurationProviderMethod == null)
            {
                throw new ArgumentNullException(nameof(configurationProviderMethod));
            }

            const BindingFlags bindingFlags = BindingFlags.InvokeMethod |
                                              BindingFlags.Public |
                                              BindingFlags.Static;

            MethodInfo configurationProvider;

            try
            {
                configurationProvider = configurationProviderType.GetMethod
                                            (configurationProviderMethod, bindingFlags, null, Type.EmptyTypes, null);
            }
            catch (AmbiguousMatchException ex)
            {
                const string message = "The specified method name is ambiguous.";
                throw new ArgumentException(message, nameof(configurationProviderMethod), ex);
            }

            var configObject = configurationProvider.Invoke(null, new object[0]);

            if (configObject == null)
            {
                const string message = "The specified method returned null.";
                throw new InvalidOperationException(message);
            }

            if (!(configObject is IRequireHttpsConfig))
            {
                const string message = "The specified method returned invalid configuration " +
                                       "object: the return value is not assignable to " +
                                       "IRequireHttpsConfig.";
                throw new InvalidOperationException(message);
            }

            config_ = (IRequireHttpsConfig)configObject;
        }
        public ConfigurableRequireHttpsAttribute(Type configurationProviderType, string configurationProviderMethod)
        {
            if (configurationProviderType == null)
            {
                throw new ArgumentNullException (nameof (configurationProviderType));
            }
            if (configurationProviderMethod == null)
            {
                throw new ArgumentNullException (nameof (configurationProviderMethod));
            }

            const BindingFlags bindingFlags = BindingFlags.InvokeMethod |
                                              BindingFlags.Public |
                                              BindingFlags.Static;

            MethodInfo configurationProvider;
            try
            {
                configurationProvider = configurationProviderType.GetMethod
                    (configurationProviderMethod, bindingFlags, null, Type.EmptyTypes, null);
            }
            catch (AmbiguousMatchException ex)
            {
                const string message = "The specified method name is ambiguous.";
                throw new ArgumentException (message, nameof (configurationProviderMethod), ex);
            }

            var configObject = configurationProvider.Invoke (null, new object[0]);
            if (configObject == null)
            {
                const string message = "The specified method returned null.";
                throw new InvalidOperationException (message);
            }

            if (!(configObject is IRequireHttpsConfig))
            {
                const string message = "The specified method returned invalid configuration " +
                                       "object: the return value is not assignable to " +
                                       "IRequireHttpsConfig.";
                throw new InvalidOperationException (message);
            }

            config_ = (IRequireHttpsConfig) configObject;
        }
 public ConfigurableRequireHttpsAttribute()
 {
     config_ = KnownSections.RequireHttps ();
 }
 public ConfigurableRequireHttpsAttribute()
 {
     config_ = KnownSections.RequireHttps();
 }