Beispiel #1
0
        /// <summary>
        /// Initializes the repository.
        /// </summary>
        /// <param name="name">The friendly name of the repository.</param>
        /// <param name="config">A collection of the name/value pairs representing the repository-specific attributes specified in the configuration for this repository.</param>
        /// <exception cref="T:System.ArgumentNullException">
        /// The name of the repository is null.
        /// </exception>
        /// <exception cref="T:System.ArgumentException">
        /// The name of the repository has a length of zero.
        /// </exception>
        /// <exception cref="T:System.InvalidOperationException">
        /// An attempt is made to call <see cref="M:System.Configuration.Provider.ProviderBase.Initialize(System.String,System.Collections.Specialized.NameValueCollection)"/> on a repository after the repository has already been initialized.
        /// </exception>
        public override void Initialize(string name, NameValueCollection config)
        {
            if (config == null)
            {
                throw new ArgumentNullException("config");
            }
            var provider = GetStringConfigValue(config, "userRepository", string.Empty);

            userRepository = userRepositoryManager.GetRepository(provider);

            appName      = GetStringConfigValue(config, "applicationName", userRepository.Name);
            providerName = !string.IsNullOrEmpty(name) ? name : userRepository.Name;

            base.Initialize(providerName, config);

            requiresUniqueEmail                  = GetBooleanConfigValue(config, "requiresUniqueEmail", false);
            requiresQuestionAndAnswer            = GetBooleanConfigValue(config, "requiresQuestionAndAnswer", false);
            passwordAttemptWindow                = GetIntegerConfigValue(config, "passwordAttemptWindow", 10);
            minRequiredPasswordLength            = GetIntegerConfigValue(config, "minRequiredPasswordLength", 7);
            minRequiredNonAlphanumericCharacters = GetIntegerConfigValue(config, "minRequiredNonalphanumericCharacters", 1);
            maxInvalidPasswordAttempts           = GetIntegerConfigValue(config, "maxInvalidPasswordAttempts", 5);
            enablePasswordReset                  = GetBooleanConfigValue(config, "enablePasswordReset", false);
            enablePasswordRetrieval              = GetBooleanConfigValue(config, "enablePasswordRetrieval", false);
            passwordStrengthRegularExpression    = GetStringConfigValue(config, "passwordStrengthRegularExpression", string.Empty);
            passwordFormat =
                (MembershipPasswordFormat)
                Enum.Parse(typeof(MembershipPasswordFormat), GetStringConfigValue(config, "passwordFormat", "Hashed"));
        }
Beispiel #2
0
        public override void Initialize(string name, NameValueCollection config)
        {
            if (config == null)
            {
                throw new ArgumentNullException("config");
            }
            var provider = GetStringConfigValue(config, "userRepository", string.Empty);

            userRepository = userRepositoryManager.GetRepository(provider);
            providerName   = !string.IsNullOrEmpty(name) ? name : userRepository.Name;
            automaticallyCreateNonExistingUsers =
                bool.Parse(GetStringConfigValue(config, "automaticallyCreateNonExistingUsers", "true"));
            deleteUsersOnProfileDeleting = bool.Parse(GetStringConfigValue(config, "deleteUsersOnProfileDeleting", "true"));
            base.Initialize(providerName, config);
            appName = GetStringConfigValue(config, "applicationName", userRepository.Name);
        }