Example #1
0
        public override void Initialize(string name, System.Collections.Specialized.NameValueCollection parameters)
        {
            if (string.IsNullOrEmpty((string)parameters["connectionName"]))
            {
                parameters.Remove("connectionName");
                parameters.Add("connectionName", "PermissionsCenter");

            }

            if (string.IsNullOrEmpty((string)parameters["sourceName"]))
            {
                parameters.Remove("sourceName");
                parameters.Add("sourceName", "DefaultSource");
            }

            this.connectionName = parameters["connectionName"];
            this.sourceName = parameters["sourceName"];

            base.Initialize(name, parameters);

            parameters.Remove("connectionName");
            parameters.Remove("sourceName");

            if (parameters.Count > 0)
            {
                string key = parameters.GetKey(0);
                if (!string.IsNullOrEmpty(key))
                    throw new ProviderException(string.Format("不识别的属性: {0} ", key));
            }
        }
 public static Dictionary<string, string> ProcessEncryptedForm(System.Collections.Specialized.NameValueCollection FormContextObject, string PrivateKey)
 {
     try
     {
         /// rsa strategy
         RSAContext context = new RSAContext();
         /// sort strategy we are using that is the bus
         context.SetStrategy(new RSAInterface());
         /// we create the collection based on a dictionary
         Dictionary<string, string> Collection = new Dictionary<string, string>();
         /// we loop now the collection
         for (int i = 0; i < FormContextObject.Count; i++)
         {
             /// get the key for the object that is the key only
             string key = FormContextObject.GetKey(i);
             /// get the for object and decrypt it
             string value = context.Decrypt(FormContextObject.Get(i), "base64", PrivateKey);
             /// we add the value for it
             Collection.Add(key, value);
         }
         /// we return the collection
         return Collection;
     }
     catch
     {
         /// we return the null entity
         return null;
     }
 }
        public InterpolatorColor(System.Collections.SortedList colorKeyFrames)
        {
            //_colors = a_colorKeyFrames;
            _interpolators = new List<Interpolator>();

            for (int i = 0; i < 4; i++)
            {
                Interpolator ip = new Interpolator();
                _interpolators.Add(ip);
                System.Collections.SortedList a = new System.Collections.SortedList();
                for (int nClrNum = 0; nClrNum < colorKeyFrames.Count; nClrNum++)
                {
                    Color clr = (Color)colorKeyFrames.GetByIndex(nClrNum);
                    double dVal = 0;
                    if (i == 0)
                        dVal = clr.A;
                    else if (i == 1)
                        dVal = clr.R;
                    else if (i == 2)
                        dVal = clr.G;
                    else if (i == 3)
                        dVal = clr.B;
                    a.Add(colorKeyFrames.GetKey(nClrNum), dVal);
                }
                ip.KeyFramesList = a;
            }
        }
        public override void Initialize(string name, System.Collections.Specialized.NameValueCollection config) {

            if (config == null)
                throw new ArgumentNullException("Config is null");

            if (String.IsNullOrEmpty(name))
                name = "UmbracoSiteMapProvider";

            if (!String.IsNullOrEmpty(config["defaultDescriptionAlias"])) {
                m_defaultDescriptionAlias = config["defaultDescriptionAlias"].ToString();
                config.Remove("defaultDescriptionAlias");
            }
            if (config["securityTrimmingEnabled"] != null) {
                m_enableSecurityTrimming = bool.Parse(config["securityTrimmingEnabled"]);
            }

            base.Initialize(name, config);

            // Throw an exception if unrecognized attributes remain
            if (config.Count > 0) {
                string attr = config.GetKey(0);
                if (!String.IsNullOrEmpty(attr))
                    throw new ProviderException
                    (String.Format("Unrecognized attribute: {0}", attr));
            }

        }
        public override void Initialize(string name, System.Collections.Specialized.NameValueCollection config)
        {
            base.Initialize(name, config);

            if (string.IsNullOrEmpty(config["dataStorePath"]))
                throw new ProviderException("dataStorePath config attribute is required.");

            this._dataStorePath = config["dataStorePath"];

            if (!VirtualPathUtility.IsAppRelative(this._dataStorePath))
                throw new ArgumentException("dataStorePath must be app-relative");

            string fullyQualifiedPath = VirtualPathUtility.Combine(
                VirtualPathUtility.AppendTrailingSlash(HttpRuntime.AppDomainAppVirtualPath),
                this._dataStorePath);

            this._dataStorePath = HostingEnvironment.MapPath(fullyQualifiedPath);

            config.Remove("dataStorePath");

            // Make sure we have permission to read the XML data source and
            // throw an exception if we don't
            if (!Directory.Exists(this._dataStorePath))
                Directory.CreateDirectory(this._dataStorePath);

            FileIOPermission permission = new FileIOPermission(FileIOPermissionAccess.AllAccess, this._dataStorePath);
            permission.Demand();

            if (config.Count > 0)
                throw new ProviderException(string.Format("Unknown config attribute '{0}'", config.GetKey(0)));
        }
        /// <summary>
        /// 初始化
        /// </summary>
        /// <param name="name"></param>
        /// <param name="config"></param>
        public override void Initialize(string name, System.Collections.Specialized.NameValueCollection config)
        {
            if (config == null)
                throw new ArgumentNullException("config");

            if (String.IsNullOrEmpty(name))
                name = "BasicEnglishAutoInputProtectionTextProvider";

            if (string.IsNullOrEmpty(config["description"]))
            {
                config.Remove("description");
                config.Add("description", "Basic English Auto-Input Protection Text Provider");
            }

            base.Initialize(name, config);

            // Throw an exception if unrecognized attributes remain
            if (config.Count > 0)
            {
                string attr = config.GetKey(0);

                if (!String.IsNullOrEmpty(attr))
                    throw new ProviderException(string.Format(System.Globalization.CultureInfo.CurrentUICulture,
                        "Errors.UnrecognizedAttribute", attr));
            }
        }
Example #7
0
    public static System.Collections.SortedList TailMap(System.Collections.SortedList list, System.Object limit)
    {
        System.Collections.Comparer comparer = System.Collections.Comparer.Default;
        System.Collections.SortedList newList = new System.Collections.SortedList();

        if (list != null)
        {
            if (list.Count > 0)
            {
                int index = 0;
                while (comparer.Compare(list.GetKey(index), limit) < 0)
                    index++;

                for (; index < list.Count; index++)
                    newList.Add(list.GetKey(index), list[list.GetKey(index)]);
            }
        }

        return newList;
    }
        public override void Initialize(string name, System.Collections.Specialized.NameValueCollection config)
        {
            base.Initialize(name, config);

            if (string.IsNullOrEmpty(config["connectionStringName"]))
                throw new ProviderException("connectionStringName config attribute must be specified.");

            this._connectionStringName = config["connectionStringName"];
            config.Remove("connectionStringName");

            if (config.Count > 0)
                throw new ProviderException(string.Format("Unknown config attribute '{0}'", config.GetKey(0)));
        }
        public void SetEditions(System.Collections.Specialized.NameValueCollection editions)
        {
            lbEditions.Items.Clear();

            for (int index = 0; index < editions.Count; index++)
            {
                global::Controls.ListBoxExItem lbItem = new global::Controls.ListBoxExItem(editions[index]);
                lbItem.Tag = editions.GetKey(index);

                lbEditions.Items.Add(lbItem);
            }

            lbEditions.SelectedIndex = 0;
        }
        public override void Initialize(string name, System.Collections.Specialized.NameValueCollection config)
        {
            if (config == null)
                throw new ArgumentNullException("config");

            if (string.IsNullOrEmpty(name))
                name = "NHibernateProjectUserProfileProvider";

            base.Initialize(name, config);

            ProviderName = name;
            ApplicationName = ExtractConfigValue(config, "applicationName", ConnectionParameters.DEFAULT_APP); //System.Web.Hosting.HostingEnvironment.ApplicationVirtualPath

            // Throw an exception if unrecognized attributes remain
            if (config.Count > 0)
            {
                var attr = config.GetKey(0);
                if (!String.IsNullOrEmpty(attr))
                    throw new System.Configuration.Provider.ProviderException("Unrecognized attribute: " +
                                                                              attr);
            }
        }
        public override void Initialize(string name, System.Collections.Specialized.NameValueCollection config)
        {
            
            if (config == null)
				throw new ArgumentNullException("config");

            if (String.IsNullOrEmpty(name))
				name = "SenseNetPersonalizationProvider";

            if (String.IsNullOrEmpty(config["description"]))
            {
                config.Remove("description");
				config.Add("description", "SenseNet Personalization Provider");
            }

            base.Initialize(name, config);

            if (config.Count > 0)
            {
                string attr = config.GetKey(0);
                if (!String.IsNullOrEmpty(attr))
                    throw new ProviderException("Unrecognized attribute: " + attr);
            }
        }
        /// <summary>
        /// Initialize
        /// </summary>
        /// <param name="name"></param>
        /// <param name="config"></param>
        public override void Initialize(string name, System.Collections.Specialized.NameValueCollection config)
        {
            if ((config == null))
            {
                throw new ArgumentNullException("You must supply a valid configuration parameters.");
            }

            this.m_name = name;

            string userName = null, roles = null, password = null;
            if (string.IsNullOrEmpty(config["description"]))
            {
                //throw new System.Configuration.Provider.ProviderException("You must specify a description attribute.");
            }
            else
            {
                this.m_description = config["description"];
                config.Remove("description");
            }

            if (string.IsNullOrEmpty(config["userName"]))
            {
                throw new System.Configuration.Provider.ProviderException("The userName is invalid.");
            }
            else
            {
                userName = config["userName"];
                config.Remove("userName");
            }
            if (string.IsNullOrEmpty(config["password"]))
            {
                //throw new System.Configuration.Provider.ProviderException("The password is invalid.");
            }
            else
            {
                password = config["password"];
                config.Remove("password");
            }

            if (string.IsNullOrEmpty(config["roles"]))
            {
                throw new System.Configuration.Provider.ProviderException("The roles is invalid.");
            }
            else
            {
                roles = config["roles"];
                config.Remove("roles");
            }

            if (config.Count > 0)
            {
                string extraAttribute = config.GetKey(0);
                if (!String.IsNullOrEmpty(extraAttribute))
                {
                    throw new System.Configuration.Provider.ProviderException(
                        "The following unrecognized attribute was found in " + Name + "'s configuration: '" +
                        extraAttribute + "'");
                }
                else
                {
                    throw new System.Configuration.Provider.ProviderException(
                        "An unrecognized attribute was found in the provider's configuration.");
                }
            }

            m_manager = new MockManager(userName, password, roles);
        }
        /// <summary>
        /// 初始化
        /// </summary>
        /// <param name="name"></param>
        /// <param name="config"></param>
        public override void Initialize(string name, System.Collections.Specialized.NameValueCollection config)
        {
            if (config == null)
                throw new ArgumentNullException("config");

            if (String.IsNullOrEmpty(name))
                name = "LineNoiseAutoInputProtectionImageProvider";

            if (string.IsNullOrEmpty(config["description"]))
            {
                config.Remove("description");
                config.Add("description", "Line Noise Auto-Input Protection Image Provider");
            }

            VerificationCodeProviderHelper helper = new VerificationCodeProviderHelper(config);

            colors.AddRange(helper.ParseCollection<Color>("colors", false, true, false, ','));

            base.Initialize(name, config);

            // Throw an exception if unrecognized attributes remain
            if (config.Count > 0)
            {
                string attr = config.GetKey(0);

                if (!String.IsNullOrEmpty(attr))
                    throw new ProviderException(string.Format(System.Globalization.CultureInfo.CurrentUICulture,
                        "Errors.UnrecognizedAttribute", attr));
            }
        }
        /// <summary>
        /// 初始化
        /// </summary>
        /// <param name="name"></param>
        /// <param name="config"></param>
        public override void Initialize(string name, System.Collections.Specialized.NameValueCollection config)
        {
            if (config == null)
                throw new ArgumentNullException("config");

            if (String.IsNullOrEmpty(name))
                name = "CrosshatchAutoInputProtectionFilterProvider";

            if (string.IsNullOrEmpty(config["description"]))
            {
                config.Remove("description");
                config.Add("description", "Crosshatch Auto-Input Protection Filter Provider");
            }

            base.Initialize(name, config);

            VerificationCodeProviderHelper helper = new VerificationCodeProviderHelper(config);

            opacity = helper.ParseSingle("opacity", false, .15F);
            randomStyle = helper.ParseBoolean("randomStyle", false, true);
            style = helper.ParseEnum("style", false, HatchStyle.DiagonalCross);
            colors.AddRange(helper.ParseCollection<Color>("colors", false, true, false, ','));

            if (colors.Count == 0)
                colors.Add(Color.Black);

            // Throw an exception if unrecognized attributes remain
            if (config.Count > 0)
            {
                string attr = config.GetKey(0);

                if (!String.IsNullOrEmpty(attr))
                    throw new Exception(string.Format(System.Globalization.CultureInfo.CurrentUICulture,
                        "Resources.Errors.UnrecognizedAttribute", attr));
            }
        }
        public override void Initialize(string name, System.Collections.Specialized.NameValueCollection config)
        {
            if (config == null)
                throw new ArgumentNullException("config");

            // Assign the provider a default name if it doesn't have one
            if (String.IsNullOrEmpty(name))
                name = "SqlMenuProvider";

            // Add a default "description" attribute to config if the
            // attribute doesn't exist or is empty
            if (string.IsNullOrEmpty(config["description"]))
            {
                config.Remove("description");
                config.Add("description",
                    "SQL Menu provider");
            }

            // Call the base class's Initialize method
            base.Initialize(name, config);

            // Initialize _applicationName
            _applicationName = config["applicationName"];

            if (string.IsNullOrEmpty(_applicationName))
                _applicationName = "/";

            config.Remove("applicationName");

            try
            {
                _isAppRootPath = bool.Parse(config["isapprootpath"]);
            }
            catch
            {
                _isAppRootPath = false;
            }
            config.Remove("isapprootpath");

            _cacheKeyPrefix = config["cachekeyprefix"];
            if (String.IsNullOrEmpty(_cacheKeyPrefix))
                _cacheKeyPrefix = _applicationName + "AspnetMenu";
            config.Remove("cachekeyprefix");

            // Initialize _connectionString
            _connectionStringName = config["connectionStringName"];

            if (String.IsNullOrEmpty(_connectionStringName))
                throw new ProviderException
                    ("Empty or missing connectionStringName");

            config.Remove("connectionStringName");

            if (WebConfigurationManager.ConnectionStrings[_connectionStringName] == null)
                throw new System.Configuration.Provider.ProviderException("Missing connection string");

            _connectionString = WebConfigurationManager.ConnectionStrings
                [_connectionStringName].ConnectionString;

            if (String.IsNullOrEmpty(_connectionString))
                throw new ProviderException("Empty connection string");

            // Throw an exception if unrecognized attributes remain
            if (config.Count > 0)
            {
                string attr = config.GetKey(0);
                if (!String.IsNullOrEmpty(attr))
                    throw new ProviderException
                        ("Unrecognized attribute: " + attr);
            }
        }
        public override void Initialize(string name, System.Collections.Specialized.NameValueCollection config)
        {
            base.Initialize(name, config);

            if (config == null)
                return;

            // Initialize _xmlFileName and make sure the path is app-relative
            _xmlFileName = config["xmlFileName"];

            if (string.IsNullOrEmpty(_xmlFileName))
                throw new ProviderException("Data store file is not specified");

            if (HttpContext.Current != null)
            {
                if (!VirtualPathUtility.IsAppRelative(_xmlFileName))
                    throw new ArgumentException("xmlFileName must be app-relative");

                string fullyQualifiedPath = VirtualPathUtility.Combine(
                    VirtualPathUtility.AppendTrailingSlash(HttpRuntime.AppDomainAppVirtualPath),
                    _xmlFileName);

                _xmlFileName = HostingEnvironment.MapPath(fullyQualifiedPath);
            }

            config.Remove("xmlFileName");

            // Make sure we have permission to read the XML data source and
            // throw an exception if we don't
            FileIOPermission permission = new FileIOPermission(FileIOPermissionAccess.Write, _xmlFileName);
            permission.Demand();

            if (config.Count > 0)
                throw new ProviderException(string.Format("Unknown config attribute '{0}'", config.GetKey(0)));

            _isInitialized = true;
        }
Example #17
0
        private List<string> collToList(System.Collections.Specialized.NameValueCollection collection)
        {
            var result = new List<string>();
            for(var i=0; i<collection.Count; i++)
              result.Add("{0} = {1}".Args(collection.GetKey(i), collection[i]));

            return result;
        }
Example #18
0
		/// <summary>
		/// 
		/// </summary>
		/// <param name="header"></param>
		/// <param name="initialCapabilities"></param>
		/// <returns></returns>
		public override System.Web.Configuration.CapabilitiesResult Process(System.Collections.Specialized.NameValueCollection header, System.Collections.IDictionary initialCapabilities)
		{
			if (initialCapabilities == null)
				initialCapabilities = new System.Collections.Generic.Dictionary<string, string>(StringComparer.OrdinalIgnoreCase);
			System.Web.Configuration.nBrowser.Result r = new System.Web.Configuration.nBrowser.Result(initialCapabilities);

#if trace
			System.Diagnostics.Trace.WriteLine(string.Join("+", new string[50]));
			for (int i=0;i <= header.Count -1;i++)
			{
				System.Diagnostics.Trace.WriteLine(string.Format("{0}{1}",header.GetKey(i).PadRight(25),header[i]));
			}
			System.Diagnostics.Trace.WriteLine(string.Join("+", new string[50]));
#endif			
			Browser().Process(header, r, new System.Collections.Generic.List<System.Text.RegularExpressions.Match>());
			return r;
		}
        public override void Initialize(string name, System.Collections.Specialized.NameValueCollection config)
        {
            if (config == null)
                throw new ArgumentNullException("config");

            if (String.IsNullOrEmpty(name))
                name = "SqlUserExtProvider";

            if (string.IsNullOrEmpty(config["description"]))
            {
                config.Remove("description");
                config.Add("description",
                    "SQL User ExtentInfo provider");
            }

            base.Initialize(name, config);

            _applicationName = config["applicationName"];

            if (string.IsNullOrEmpty(_applicationName))
                _applicationName = "/";

            config.Remove("applicationName");

            _cacheKeyPrefix = config["cachekeyprefix"];
            if (String.IsNullOrEmpty(_cacheKeyPrefix))
                _cacheKeyPrefix = _applicationName + "AspnetMenu";
            config.Remove("cachekeyprefix");

            // Initialize _connectionString
            _connectionStringName = config["connectionStringName"];

            if (String.IsNullOrEmpty(_connectionStringName))
                throw new ProviderException
                    ("Empty or missing connectionStringName");

            config.Remove("connectionStringName");

            if (WebConfigurationManager.ConnectionStrings[_connectionStringName] == null)
                throw new System.Configuration.Provider.ProviderException("Missing connection string");

            if (config.Count > 0)
            {
                string attr = config.GetKey(0);
                if (!String.IsNullOrEmpty(attr))
                    throw new ProviderException
                        ("Unrecognized attribute: " + attr);
            }
        }
        public override void Initialize(String name, System.Collections.Specialized.NameValueCollection config)
        {
            if (config == null)
                throw new ArgumentNullException("config");

            if (String.IsNullOrEmpty(name))
                name = "EucalyptoForumProvider";

            base.Initialize(name, config);

            ProviderName = name;

            //Connection string
            var connName = ExtractConfigValue(config, "connectionStringName", null);
            Configuration = ConfigurationHelper.Create(connName);

            ReceiveNotificationPropertyInProfile = ExtractConfigValue(config, "receiveNotificationPropertyInProfile", null);

            //Notification provider
            string notificationProviderName = ExtractConfigValue(config, "notificationProvider", null);
            if (!String.IsNullOrEmpty(notificationProviderName))
            {
                NotificationProvider = Notification.NotificationManager.Providers[notificationProviderName];
                if (NotificationProvider == null)
                {
                    // try to use DefaultProvider
                    NotificationProvider = Notification.NotificationManager.GetDefaultNotificationProvider();
                    if (NotificationProvider == null)
                    {
                        throw new EucalyptoException("NotificationProvider " + notificationProviderName + " not defined");
                    }
                }

            }

            // Throw an exception if unrecognized attributes remain
            if (config.Count > 0)
            {
                string attr = config.GetKey(0);
                if (!String.IsNullOrEmpty(attr))
                    throw new System.Configuration.Provider.ProviderException("Unrecognized attribute: " +
                    attr);
            }
        }
        ///// <summary>
        ///// SetWebServiceAddress
        ///// </summary>
        ///// <param name="serverIp"></param>
        ///// <param name="serverPort"></param>
        //public void SetWebServiceAddress(string serverIp, short serverPort)
        //{
        //    string serviceAddress = m_webServiceAddress;
        //    string httpName = "http://";
        //    if (m_webServiceAddress.StartsWith(httpName))
        //    {
        //        int idx = serviceAddress.IndexOf('/', httpName.Length);
        //        serviceAddress = serviceAddress.Substring(idx);
        //    }
        //    m_manager = new WebServiceManager("http://" + serverIp + ":" + serverPort + serviceAddress);
        //}
        /// <summary>
        /// Initialize
        /// </summary>
        /// <param name="name"></param>
        /// <param name="config"></param>
        public override void Initialize(string name, System.Collections.Specialized.NameValueCollection config)
        {
            if ((config == null) || (config.Count == 0))
            {
                throw new ArgumentNullException("You must supply a valid configuration parameters.", "config");
            }

            this.m_name = name;
            if (string.IsNullOrEmpty(config["description"]))
            {
                //throw new System.Configuration.Provider.ProviderException("You must specify a description attribute.");
            }
            else
            {
                this.m_description = config["description"];
                config.Remove("description");
            }
            string webServiceAddress;
            if (string.IsNullOrEmpty(config["webServiceAddress"]))
            {
                webServiceAddress = string.Format("{0}/{1}/WebLogin.asmx", SystemConfiguration.Server, SystemConfiguration.ApplicationName);
                //throw new System.Configuration.Provider.ProviderException("The webServiceAddress is invalid.");
            }
            else
            {
                webServiceAddress = config["webServiceAddress"];
            }
            config.Remove("webServiceAddress");

            if (config.Count > 0)
            {
                string extraAttribute = config.GetKey(0);
                if (!String.IsNullOrEmpty(extraAttribute))
                {
                    throw new System.Configuration.Provider.ProviderException(
                        "The following unrecognized attribute was found in " + Name + "'s configuration: '" +
                        extraAttribute + "'");
                }
                else
                {
                    throw new System.Configuration.Provider.ProviderException(
                        "An unrecognized attribute was found in the provider's configuration.");
                }
            }

            //ConnectionStringsSection cs =
            //    (ConnectionStringsSection)ConfigurationManager.GetSection("connectionStrings");
            //if (cs == null)
            //    throw new ProviderException("An error occurred retrieving the connection strings section.");
            //if (cs.ConnectionStrings[connectionString] == null)
            //    throw new ProviderException("The connection string could not be found in the connection strings section.");
            //else
            //    ConnectionString = cs.ConnectionStrings[connectionString].ConnectionString;

            m_manager = new WebServiceManager(webServiceAddress);
        }
        public override void Initialize(string name, System.Collections.Specialized.NameValueCollection config)
        {
            if (config == null)
                throw new ArgumentNullException("config");

            if (name == null || name.Length == 0)
                name = "EucalyptoMembershipProvider";

            base.Initialize(name, config);

            this.mProviderName = name;
            this.mApplicationName = ExtractConfigValue(config, "applicationName", ConnectionParameters.DEFAULT_APP); //System.Web.Hosting.HostingEnvironment.ApplicationVirtualPath
            this.mEnablePasswordReset = bool.Parse(ExtractConfigValue(config, "enablePasswordReset", "true"));
            this.mEnablePasswordRetrieval = false; //bool.Parse(GetConfigValue(config["enablePasswordRetrieval"], "false"));
            this.mMaxInvalidPasswordAttempts = int.Parse(ExtractConfigValue(config, "maxInvalidPasswordAttempts", "5"));
            this.mMinRequiredNonAlphanumericCharacters = int.Parse(ExtractConfigValue(config, "minRequiredNonAlphanumericCharacters", "1"));
            this.mMinRequiredPasswordLength = int.Parse(ExtractConfigValue(config, "minRequiredPasswordLength", "7"));
            this.mPasswordAttemptWindow = int.Parse(ExtractConfigValue(config, "passwordAttemptWindow", "10"));
            this.mPasswordFormat = MembershipPasswordFormat.Hashed; //Enum.Parse(typeof(MembershipPasswordFormat), GetConfigValue(config["passwordFormat"], "Hashed"));
            this.mPasswordStrengthRegularExpression = ExtractConfigValue(config, "passwordStrengthRegularExpression", "");
            this.mRequiresQuestionAndAnswer = bool.Parse(ExtractConfigValue(config, "requiresQuestionAndAnswer", "false"));
            this.mRequiresUniqueEmail = bool.Parse(ExtractConfigValue(config, "requiresUniqueEmail", "true"));

            string connName = ExtractConfigValue(config, "connectionStringName", null);
            mConfiguration = ConfigurationHelper.Create(connName);

            // Throw an exception if unrecognized attributes remain
            if (config.Count > 0)
            {
                string attr = config.GetKey(0);
                if (!String.IsNullOrEmpty(attr))
                    throw new System.Configuration.Provider.ProviderException("Unrecognized attribute: " +
                    attr);
            }
        }
        public override void Initialize(string name, System.Collections.Specialized.NameValueCollection config)
        {
            if (config == null)
                throw new ArgumentNullException("config");

            if (name == null || name.Length == 0)
                name = "EucalyptoWikiProvider";

            base.Initialize(name, config);

            this.mProviderName = name;

            //Read the configurations
            //Connection string
            string connName = ExtractConfigValue(config, "connectionStringName", null);
            mConfiguration = ConfigurationHelper.Create(connName);

            // Throw an exception if unrecognized attributes remain
            if (config.Count > 0)
            {
                string attr = config.GetKey(0);
                if (!String.IsNullOrEmpty(attr))
                    throw new System.Configuration.Provider.ProviderException("Unrecognized attribute: " +
                    attr);
            }
        }
        public override void Initialize(string name, System.Collections.Specialized.NameValueCollection config)
        {
            if (config == null)
            throw new ArgumentNullException("config");

              if (name == null || name.Length == 0)
            name = "EucalyptoRoleProvider";

              base.Initialize(name, config);

              this.mProviderName = name;
              this.mApplicationName = ExtractConfigValue(config, "applicationName", ConnectionParameters.DEFAULT_APP); //System.Web.Hosting.HostingEnvironment.ApplicationVirtualPath

              string connName = ExtractConfigValue(config, "connectionStringName", null);
              mConfiguration = ConfigurationHelper.Create(connName);

              // Throw an exception if unrecognized attributes remain
              if (config.Count > 0)
              {
            string attr = config.GetKey(0);
            if (!String.IsNullOrEmpty(attr))
              throw new System.Configuration.Provider.ProviderException("Unrecognized attribute: " +
              attr);
              }
        }
Example #25
0
		/// <summary>
		/// Returns a portion of the list whose keys are less than the limit object parameter.
		/// </summary>
		/// <param name="l">The list where the portion will be extracted.</param>
		/// <param name="limit">The end element of the portion to extract.</param>
		/// <returns>The portion of the collection whose elements are less than the limit object parameter.</returns>
		public static System.Collections.SortedList HeadMap(System.Collections.SortedList l, System.Object limit)
		{
			System.Collections.Comparer comparer = System.Collections.Comparer.Default;
			System.Collections.SortedList newList = new System.Collections.SortedList();

			for (int i=0; i < l.Count; i++)
			{
				if (comparer.Compare(l.GetKey(i), limit) >= 0)
					break;

				newList.Add(l.GetKey(i), l[l.GetKey(i)]);
			}

			return newList;
		}
Example #26
0
        public override void Initialize(string name, System.Collections.Specialized.NameValueCollection config)
        {
            base.Initialize(name, config);

            if (config.Count > 0)
                throw new ProviderException(string.Format("Unknown config attribute '{0}'", config.GetKey(0)));
        }
Example #27
0
        /// <summary>
        /// 使用 ASP.NET 应用程序配置文件中指定的属性值初始化成员资格提供程序。
        /// 此方法不应从代码直接使用。
        /// </summary>
        /// <param name="name">要初始化的 ExtendedMembershipProvider 实例的名称。</param>
        /// <param name="config">
        /// 一个 NameValueCollection,其中包含成员资格提供程序配置选项的值和名称。 
        /// </param>
        public override void Initialize(string name, System.Collections.Specialized.NameValueCollection config)
        {
            if (config == null)
            {
                throw new ArgumentNullException("config");
            }

            if (String.IsNullOrEmpty(name))
            {
                name = "AHMembershipProvider";
            }

            if (String.IsNullOrEmpty(config["description"]))
            {
                config.Remove("description");
                config.Add("description", "AHCMS.Framework.Security Membership Provider");
            }

            base.Initialize(name, config);

            this.enablePasswordRetrieval = SecUtility.GetBooleanValue(
                config, "enablePasswordRetrieval", false);
            this.enablePasswordReset = SecUtility.GetBooleanValue(
                config, "enablePasswordReset", true);
            this.requiresQuestionAndAnswer = SecUtility.GetBooleanValue(
                config, "requiresQuestionAndAnswer", true);
            this.requiresUniqueEmail = SecUtility.GetBooleanValue(
                config, "requiresUniqueEmail", true);
            this.maxInvalidPasswordAttempts = SecUtility.GetIntValue(
                config, "maxInvalidPasswordAttempts", 5, false, 0);
            this.passwordAttemptWindow = SecUtility.GetIntValue(
                config, "passwordAttemptWindow", 10, false, 0);
            this.minRequiredPasswordLength = SecUtility.GetIntValue(
                config, "minRequiredPasswordLength", 7, false, 128);
            this.minRequiredNonAlphanumericCharacters = SecUtility.GetIntValue(
                config, "minRequiredNonalphanumericCharacters", 1, true, 128);

            this.passwordStrengthRegularExpression =
                config["passwordStrengthRegularExpression"];
            if (this.passwordStrengthRegularExpression != null)
            {
                this.passwordStrengthRegularExpression =
                    this.passwordStrengthRegularExpression.Trim();
                if (this.passwordStrengthRegularExpression.Length != 0)
                {
                    try
                    {
                        new Regex(this.passwordStrengthRegularExpression);
                    }
                    catch (ArgumentException e)
                    {
                        throw new ProviderException(e.Message, e);
                    }
                }
            }
            else
            {
                this.passwordStrengthRegularExpression = String.Empty;
            }

            string strTemp = config["passwordFormat"];
            if (strTemp == null)
            {
                strTemp = "Hashed";
            }

            switch (strTemp)
            {
                case "Clear":
                    this.passwordFormat =
                        System.Web.Security.MembershipPasswordFormat.Clear;
                    break;
                case "Encrypted":
                    this.passwordFormat =
                        System.Web.Security.MembershipPasswordFormat.Encrypted;
                    break;
                case "Hashed":
                    this.passwordFormat =
                        System.Web.Security.MembershipPasswordFormat.Hashed;
                    break;
                default:
                    throw new ProviderException("Bad password format.");
            }

            if (this.passwordFormat == System.Web.Security.MembershipPasswordFormat.Hashed
                && this.enablePasswordRetrieval)
            {
                throw new ProviderException("Provider cannot retrieve hashed password.");
            }

            config.Remove("repository");
            config.Remove("applicationName");
            config.Remove("enablePasswordRetrieval");
            config.Remove("enablePasswordReset");
            config.Remove("requiresQuestionAndAnswer");
            config.Remove("requiresUniqueEmail");
            config.Remove("maxInvalidPasswordAttempts");
            config.Remove("passwordAttemptWindow");
            config.Remove("passwordFormat");
            config.Remove("name");
            config.Remove("description");
            config.Remove("minRequiredPasswordLength");
            config.Remove("minRequiredNonalphanumericCharacters");
            config.Remove("passwordStrengthRegularExpression");

            if (config.Count > 0)
            {
                string attribUnrecognized = config.GetKey(0);
                if (!String.IsNullOrEmpty(attribUnrecognized))
                {
                    throw new ProviderException(
                        "Provider unrecognized attribute: " + attribUnrecognized);
                }
            }
        }
Example #28
0
		/// <summary>
		/// Returns a portion of the list whose keys are greater that the lowerLimit parameter less than the upperLimit parameter.
		/// </summary>
		/// <param name="l">The list where the portion will be extracted.</param>
		/// <param name="limit">The start element of the portion to extract.</param>
		/// <param name="limit">The end element of the portion to extract.</param>
		/// <returns>The portion of the collection.</returns>
		public static System.Collections.SortedList SubMap(System.Collections.SortedList list, System.Object lowerLimit, System.Object upperLimit)
		{
			System.Collections.Comparer comparer = System.Collections.Comparer.Default;
			System.Collections.SortedList newList = new System.Collections.SortedList();

			if (list != null)
			{
				if ((list.Count > 0)&&(!(lowerLimit.Equals(upperLimit))))
				{
					int index = 0;
					while (comparer.Compare(list.GetKey(index), lowerLimit) < 0)
						index++;

					for (; index < list.Count; index++)
					{
						if (comparer.Compare(list.GetKey(index), upperLimit) >= 0)
							break;

						newList.Add(list.GetKey(index), list[list.GetKey(index)]);
					}
				}
			}

			return newList;
		}
Example #29
0
		/// <summary>
		///		Renders a set of solid objects.
		/// </summary>
		protected virtual void RenderSolidObjects( System.Collections.SortedList list,
												   bool doLightIteration,
												   LightList manualLightList )
		{
			// ----- SOLIDS LOOP -----
			for ( int i = 0; i < list.Count; i++ )
			{
				RenderableList renderables = (RenderableList)list.GetByIndex( i );

				// bypass if this group is empty
				if ( renderables.Count == 0 )
				{
					continue;
				}

				Pass pass = (Pass)list.GetKey( i );

				// Give SM a chance to eliminate this pass
				if ( !this.ValidatePassForRendering( pass ) )
				{
					continue;
				}

				// For solids, we try to do each pass in turn
				Pass usedPass = this.SetPass( pass );

				// render each object associated with this rendering pass
				for ( int r = 0; r < renderables.Count; r++ )
				{
					IRenderable renderable = (IRenderable)renderables[ r ];

					// Give SM a chance to eliminate
					if ( !this.ValidateRenderableForRendering( usedPass, renderable ) )
					{
						continue;
					}

					// Render a single object, this will set up auto params if required
					this.RenderSingleObject( renderable, usedPass, doLightIteration, manualLightList );
				}
			}
		}
        /// <summary>
        /// Converts the WebHeaderCollection to a WebHeader array.
        /// </summary>
        /// <param name="headers"> The WebHeaderCollection to convert.</param>
        public static WebHeader[] ToArray(System.Net.WebHeaderCollection headers)
        {
            WebHeader[] array = new WebHeader[headers.Count];

            for (int i=0;i<headers.Count;i++)
            {
                string name = headers.GetKey(i);
                string val = headers[name];
                array[i] = new WebHeader(name, val);
            }

            return array;
        }