public override void Initialize(string name, NameValueCollection config) { base.Initialize(name, config); try { if (SalesforceSettings.Disabled) { LogHelper.Info("Salesforce connector is disabled.", this); return; } if (MainUtil.GetBool(config["disabled"], false)) { LogHelper.Info(string.Format("Provider is disabled. Provider name: {0}", this.Name), this); return; } var configuration = SalesforceManager.GetConfiguration(name); if (configuration == null) { LogHelper.Error("Initialization failed. Configuration is null.", this); return; } this.ContactsApi = configuration.Api.ContactsApi; this.RolesApi = configuration.Api.RolesApi; this.Cache = configuration.Cache; this.ApplicationName = config["applicationName"]; this.ReadOnly = MainUtil.GetBool(config["readOnly"], false); this.Initialized = true; } catch (Exception ex) { this.Initialized = false; LogHelper.Error(string.Format("Provider couldn't be initialized. Provider name: {0}", this.Name), this, ex); } }
public override void Initialize(string name, NameValueCollection config) { base.Initialize(name, config); try { if (SalesforceSettings.Disabled) { LogHelper.Info("Salesforce connector is disabled.", this); return; } if (MainUtil.GetBool(config["disabled"], false)) { LogHelper.Info(string.Format("Provider is disabled. Provider name: {0}", this.Name), this); return; } var configuration = SalesforceManager.GetConfiguration(name); if (configuration == null) { LogHelper.Error("Initialization failed. Configuration is null.", this); return; } this.ApplicationName = config["applicationName"]; this.ReadOnly = MainUtil.GetBool(config["readOnly"], false); this.enablePasswordReset = MainUtil.GetBool(config["enablePasswordReset"], true); this.minRequiredPasswordLength = MainUtil.GetInt(config["minRequiredPasswordLength"], 7); this.minRequiredNonalphanumericCharacters = MainUtil.GetInt(config["minRequiredNonalphanumericCharacters"], 0); this.maxInvalidPasswordAttempts = MainUtil.GetInt(config["maxInvalidPasswordAttempts"], 5); this.passwordAttemptWindow = MainUtil.GetInt(config["passwordAttemptWindow"], 0); this.passwordStrengthRegularExpression = StringUtil.GetString(new[] { config["passwordStrengthRegularExpression"], string.Empty }).Trim(); this.requiresQuestionAndAnswer = MainUtil.GetBool(config["requiresQuestionAndAnswer"], false); if (!string.IsNullOrEmpty(this.PasswordStrengthRegularExpression)) { try { new Regex(this.PasswordStrengthRegularExpression); } catch (ArgumentException exception) { throw new ProviderException(exception.Message, exception); } } this.requiresUniqueEmail = MainUtil.GetBool(config["requiresUniqueEmail"], false); this.Client = configuration.Client; this.ContactsApi = configuration.Api.ContactsApi; this.FieldMapping = configuration.FieldMapping; this.Cache = configuration.Cache; this.Initialized = true; } catch (Exception ex) { this.Initialized = false; LogHelper.Error(string.Format("Provider initialization error. Provider name: {0}", this.Name), this, ex); } }