Exemple #1
0
        public override void Initialize(string name, NameValueCollection config)
        {
            if (config == null)
            {
                throw new ArgumentNullException("config");
            }

            if (string.IsNullOrEmpty(name))
            {
                name = "DerbyProfileProvider";
            }

            if (string.IsNullOrEmpty(config ["description"]))
            {
                config.Remove("description");
                config.Add("description", "Derby profile provider");
            }
            base.Initialize(name, config);

            _applicationName = GetStringConfigValue(config, "applicationName", "/");

            ProfileSection profileSection       = (ProfileSection)WebConfigurationManager.GetSection("system.web/profile");
            string         connectionStringName = config ["connectionStringName"];

            _connectionString = WebConfigurationManager.ConnectionStrings [connectionStringName];
            if (_connectionString == null)
            {
                throw new ProviderException(String.Format("The connection name '{0}' was not found in the applications configuration or the connection string is empty.", connectionStringName));
            }

            string shutdown = config ["shutdown"];

            if (!String.IsNullOrEmpty(shutdown))
            {
                _shutDownPolicy = (DerbyUnloadManager.DerbyShutDownPolicy)Enum.Parse(typeof(DerbyUnloadManager.DerbyShutDownPolicy), shutdown, true);
            }
        }
Exemple #2
0
        public override void Initialize(string name, NameValueCollection config)
        {
            if (config == null)
            {
                throw new ArgumentNullException("config");
            }

            base.Initialize(name, config);

            applicationName = config ["applicationName"];
            string connectionStringName = config ["connectionStringName"];

            if (applicationName.Length > 256)
            {
                throw new ProviderException("The ApplicationName attribute must be 256 characters long or less.");
            }
            if (connectionStringName == null || connectionStringName.Length == 0)
            {
                throw new ProviderException("The ConnectionStringName attribute must be present and non-zero length.");
            }

            // XXX check connectionStringName and commandTimeout

            connectionString = WebConfigurationManager.ConnectionStrings [connectionStringName];
            if (connectionString == null)
            {
                throw new ProviderException(String.Format("The connection name '{0}' was not found in the applications configuration or the connection string is empty.", connectionStringName));
            }

            string shutdown = config ["shutdown"];

            if (!String.IsNullOrEmpty(shutdown))
            {
                shutDownPolicy = (DerbyUnloadManager.DerbyShutDownPolicy)Enum.Parse(typeof(DerbyUnloadManager.DerbyShutDownPolicy), shutdown, true);
            }
        }
        public override void Initialize(string name, NameValueCollection config)
        {
            if (config == null)
            {
                throw new ArgumentNullException("config");
            }

            base.Initialize(name, config);

            applicationName           = GetStringConfigValue(config, "applicationName", "/");
            enablePasswordReset       = GetBoolConfigValue(config, "enablePasswordReset", true);
            enablePasswordRetrieval   = GetBoolConfigValue(config, "enablePasswordRetrieval", false);
            requiresQuestionAndAnswer = GetBoolConfigValue(config, "requiresQuestionAndAnswer", true);
            requiresUniqueEmail       = GetBoolConfigValue(config, "requiresUniqueEmail", false);
            passwordFormat            = (MembershipPasswordFormat)GetEnumConfigValue(config, "passwordFormat", typeof(MembershipPasswordFormat),
                                                                                     (int)MembershipPasswordFormat.Hashed);
            maxInvalidPasswordAttempts           = GetIntConfigValue(config, "maxInvalidPasswordAttempts", 5);
            minRequiredPasswordLength            = GetIntConfigValue(config, "minRequiredPasswordLength", 7);
            minRequiredNonAlphanumericCharacters = GetIntConfigValue(config, "minRequiredNonAlphanumericCharacters", 1);
            passwordAttemptWindow             = GetIntConfigValue(config, "passwordAttemptWindow", 10);
            passwordStrengthRegularExpression = GetStringConfigValue(config, "passwordStrengthRegularExpression", "");

            MembershipSection section = (MembershipSection)WebConfigurationManager.GetSection("system.web/membership");

            userIsOnlineTimeWindow = section.UserIsOnlineTimeWindow;

            /* we can't support password retrieval with hashed passwords */
            if (passwordFormat == MembershipPasswordFormat.Hashed && enablePasswordRetrieval)
            {
                throw new ProviderException("password retrieval cannot be used with hashed passwords");
            }

            string connectionStringName = config ["connectionStringName"];

            if (applicationName.Length > 256)
            {
                throw new ProviderException("The ApplicationName attribute must be 256 characters long or less.");
            }
            if (connectionStringName == null || connectionStringName.Length == 0)
            {
                throw new ProviderException("The ConnectionStringName attribute must be present and non-zero length.");
            }

            connectionString = WebConfigurationManager.ConnectionStrings [connectionStringName];
            if (connectionString == null)
            {
                throw new ProviderException(String.Format("The connection name '{0}' was not found in the applications configuration or the connection string is empty.", connectionStringName));
            }

            if (connectionString == null)
            {
                throw new ProviderException(String.Format("The connection name '{0}' was not found in the applications configuration or the connection string is empty.", connectionStringName));
            }

            string shutdown = config ["shutdown"];

            if (!String.IsNullOrEmpty(shutdown))
            {
                shutDownPolicy = (DerbyUnloadManager.DerbyShutDownPolicy)Enum.Parse(typeof(DerbyUnloadManager.DerbyShutDownPolicy), shutdown, true);
            }
        }
		public override void Initialize (string name, NameValueCollection config)
		{
			if (config == null)
				throw new ArgumentNullException ("config");

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

			if (string.IsNullOrEmpty (config ["description"])) {
				config.Remove ("description");
				config.Add ("description", "Derby profile provider");
			}
			base.Initialize (name, config);

			_applicationName = GetStringConfigValue (config, "applicationName", "/");

			ProfileSection profileSection = (ProfileSection) WebConfigurationManager.GetSection ("system.web/profile");
			string connectionStringName = config ["connectionStringName"];
			_connectionString = WebConfigurationManager.ConnectionStrings [connectionStringName];
			if (_connectionString == null)
				throw new ProviderException (String.Format ("The connection name '{0}' was not found in the applications configuration or the connection string is empty.", connectionStringName));

			string shutdown = config ["shutdown"];
			if (!String.IsNullOrEmpty (shutdown))
				_shutDownPolicy = (DerbyUnloadManager.DerbyShutDownPolicy) Enum.Parse (typeof (DerbyUnloadManager.DerbyShutDownPolicy), shutdown, true);
		}
Exemple #5
0
		public override void Initialize (string name, NameValueCollection config)
		{
			if (config == null)
				throw new ArgumentNullException ("config");

			base.Initialize (name, config);

			applicationName = config ["applicationName"];
			string connectionStringName = config ["connectionStringName"];

			if (applicationName.Length > 256)
				throw new ProviderException ("The ApplicationName attribute must be 256 characters long or less.");
			if (connectionStringName == null || connectionStringName.Length == 0)
				throw new ProviderException ("The ConnectionStringName attribute must be present and non-zero length.");

			// XXX check connectionStringName and commandTimeout

			connectionString = WebConfigurationManager.ConnectionStrings [connectionStringName];
			if (connectionString == null)
				throw new ProviderException (String.Format("The connection name '{0}' was not found in the applications configuration or the connection string is empty.", connectionStringName));

			string shutdown = config ["shutdown"];
			if (!String.IsNullOrEmpty (shutdown))
				shutDownPolicy = (DerbyUnloadManager.DerbyShutDownPolicy) Enum.Parse (typeof (DerbyUnloadManager.DerbyShutDownPolicy), shutdown, true);
		}
		public override void Initialize (string name, NameValueCollection config)
		{
			if (config == null)
				throw new ArgumentNullException ("config");

			base.Initialize (name, config);

			applicationName = GetStringConfigValue (config, "applicationName", "/");
			enablePasswordReset = GetBoolConfigValue (config, "enablePasswordReset", true);
			enablePasswordRetrieval = GetBoolConfigValue (config, "enablePasswordRetrieval", false);
			requiresQuestionAndAnswer = GetBoolConfigValue (config, "requiresQuestionAndAnswer", true);
			requiresUniqueEmail = GetBoolConfigValue (config, "requiresUniqueEmail", false);
			passwordFormat = (MembershipPasswordFormat) GetEnumConfigValue (config, "passwordFormat", typeof (MembershipPasswordFormat),
											   (int) MembershipPasswordFormat.Hashed);
			maxInvalidPasswordAttempts = GetIntConfigValue (config, "maxInvalidPasswordAttempts", 5);
			minRequiredPasswordLength = GetIntConfigValue (config, "minRequiredPasswordLength", 7);
			minRequiredNonAlphanumericCharacters = GetIntConfigValue (config, "minRequiredNonAlphanumericCharacters", 1);
			passwordAttemptWindow = GetIntConfigValue (config, "passwordAttemptWindow", 10);
			passwordStrengthRegularExpression = GetStringConfigValue (config, "passwordStrengthRegularExpression", "");

			MembershipSection section = (MembershipSection) WebConfigurationManager.GetSection ("system.web/membership");

			userIsOnlineTimeWindow = section.UserIsOnlineTimeWindow;

			/* we can't support password retrieval with hashed passwords */
			if (passwordFormat == MembershipPasswordFormat.Hashed && enablePasswordRetrieval)
				throw new ProviderException ("password retrieval cannot be used with hashed passwords");

			string connectionStringName = config ["connectionStringName"];

			if (applicationName.Length > 256)
				throw new ProviderException ("The ApplicationName attribute must be 256 characters long or less.");
			if (connectionStringName == null || connectionStringName.Length == 0)
				throw new ProviderException ("The ConnectionStringName attribute must be present and non-zero length.");

			connectionString = WebConfigurationManager.ConnectionStrings [connectionStringName];
			if (connectionString == null)
				throw new ProviderException (String.Format ("The connection name '{0}' was not found in the applications configuration or the connection string is empty.", connectionStringName));

			if (connectionString == null)
				throw new ProviderException (String.Format ("The connection name '{0}' was not found in the applications configuration or the connection string is empty.", connectionStringName));

			string shutdown = config ["shutdown"];
			if (!String.IsNullOrEmpty (shutdown))
				shutDownPolicy = (DerbyUnloadManager.DerbyShutDownPolicy) Enum.Parse (typeof (DerbyUnloadManager.DerbyShutDownPolicy), shutdown, true);
		}