Example #1
0
        public void SetUpTest()
        {
            ProviderHelper <SalesforceProvider, ProviderCollection <SalesforceProvider> > .DefaultProvider = new SalesforceProvider();

            var configuration = SalesforceManager.GetConfiguration("salesforce");

            this.Client = configuration.Client;
        }
        public void SetUpTest()
        {
            ProviderHelper <SalesforceProvider, ProviderCollection <SalesforceProvider> > .DefaultProvider = new SalesforceProvider();

            var configuration = SalesforceManager.GetConfiguration("salesforce");

            this.Client       = configuration.Client;
            this.ContactsApi  = configuration.Api.ContactsApi;
            this.FieldMapping = configuration.FieldMapping;
        }
Example #3
0
        public void SetUpTest()
        {
            var configuration = SalesforceManager.GetConfiguration("salesforce");

            this.Client      = configuration.Client;
            this.ContactsApi = configuration.Api.ContactsApi;
            this.RolesApi    = configuration.Api.RolesApi;

            this.InitializeRoles("Test-Role-Get", "Test-Role-1");

            this.InitializeUsersInRole("Test-Role-1", "*****@*****.**");
        }
        public void SetUpTest()
        {
            this.profileProvider = new SalesforceProfileProvider();
            this.profileProvider.Initialize("salesforce", new NameValueCollection()
            {
                { "readOnly", "false" }, { "applicationName", "sitecore" }
            });

            var configuration = SalesforceManager.GetConfiguration(this.profileProvider.Name);

            this.Client      = configuration.Client;
            this.ContactsApi = configuration.Api.ContactsApi;
        }
        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.FieldMapping         = configuration.FieldMapping;
                this.ProfileConfiguration = configuration.Profile;
                this.Cache = configuration.Cache;

                this.SaleforcePropertyNames = configuration.Profile.Properties.Select(i => i.SalesforceName).ToArray();

                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 initialization error. Provider name: {0}", this.Name), this, ex);
            }
        }
Example #6
0
        public void SetUpTest()
        {
            this.membershipProvider = new SalesforceMembershipProvider();
            this.membershipProvider.Initialize(
                "salesforce",
                new NameValueCollection
            {
                { "applicationName", "sitecore" },
                { "readOnly", "false" },
                { "enablePasswordReset", "true" },
                { "minRequiredPasswordLength", "1" },
                { "passwordStrengthRegularExpression", ".*" },
                { "minRequiredNonalphanumericCharacters", "0" },
                { "maxInvalidPasswordAttempts", "5" },
                { "passwordAttemptWindow", "0" },
                { "requiresUniqueEmail", "true" }
            });

            var configuration = SalesforceManager.GetConfiguration("salesforce");

            this.Client      = configuration.Client;
            this.ContactsApi = configuration.Api.ContactsApi;
        }
        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);
            }
        }