/// <summary> /// Initializes the provider with the specified values. /// </summary> /// <param name="name">The name of the provider.</param> /// <param name="configValue">Provider specific attributes.</param> public override void Initialize(string name, NameValueCollection configValue) { base.Initialize(name, configValue); ServiceName = configValue.GetStringValue("serviceName", ""); ServiceMachineName = configValue.GetStringValue("serviceMachineName", ""); OutputFileNameToWatch = configValue.GetStringValue("outputFileNameToWatch", ""); OutputFileExpectedAgeMinutes = configValue.GetInt32Value("outputFileExpectedAgeMinutes", 0); OutputFileMaxAgeMinutes = configValue.GetInt32Value("outputFileMaxAgeMinutes", 60); AssertConfigurationValid(); }
private void InitializeInternal(string name, NameValueCollection configValue) { base.Initialize(name, configValue); NameRegexExpression = configValue.GetStringValue("nameRegexExpression", "^([a-zA-Z0-9\\-_\\s])*$"); EmailRegexExpression = configValue.GetStringValue("emailRegexExpression", "^([0-9a-zA-Z]+[-\\._+&]*)*[0-9a-zA-Z]+@([-0-9a-zA-Z]+[.])+[a-zA-Z]{2,6}$"); PasswordRegexExpression = configValue.GetStringValue("passwordRegexExpression", "^([a-zA-Z0-9@*#]{6,128})$"); PasswordErrorMessage = configValue.GetStringValue("passwordErrorMessage", "The password must be between 6 and 32 characters long; and can only contain letters, numbers, and these special symbols(@, *, #)"); BaseHashIterations = configValue.GetInt32Value("baseHashIterations", 5000); HashGroupMinimum = configValue.GetInt32Value("hashGroupMinimum", 1); HashGroupMaximum = configValue.GetInt32Value("hashGroupMaximum", 1000); ExtendedSessionDuration = configValue.GetInt32Value("extendedSessionDuration", 20160); //20160=2weeks PublicSessionDuration = configValue.GetInt32Value("publicSessionDuration", 20); //20 minutes default. PasswordResetCodeExpirationHours = configValue.GetInt32Value("PasswordResetCodeExpirationHours", 1); GuestUserExpirationDays = configValue.GetInt32Value("GuestUserExpirationDays", 14); _hashProviderName = configValue.GetStringValue("hashProviderName", String.Empty); if (!string.IsNullOrEmpty(_hashProviderName)) { // ReSharper disable NotResolvedInText if (HashManager.Providers[_hashProviderName] == null) throw new ArgumentOutOfRangeException("hashProviderName", _hashProviderName, "The specified HashProviderName does not exist."); // ReSharper restore NotResolvedInText } PasswordExpiration = configValue.GetInt32Value("passwordExpiration", PasswordExpiration); LoginExceededFailureMessage = configValue.GetStringValue("loginExceededFailureMessage", "Too many recent failed attempts have been made for this name. " + "Either you entered the wrong password or an account by this name does not exist. " + "If this is your account, try again later or email support with your problem. " + "For security do not include your password in any email."); LoginCredentialsFailureMessage = configValue.GetStringValue("loginCredentialsFailureMessage", "The supplied name or password is incorrect."); FailurePeriodMinutes = configValue.GetInt32Value("failurePeriodMinutes", 20); AllowedFailuresPerPeriod = configValue.GetInt32Value("allowedFailuresPerPeriod", 5); String impersonateRoles = configValue.GetStringValue("impersonationAllowedRoles", "Administrator"); ImpersonationAllowedRoles = !String.IsNullOrEmpty(impersonateRoles) ? impersonateRoles.Split(';', ',') : new string[] { }; }