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

            if (String.IsNullOrEmpty(name))
            {
                name = PROVIDER_NAME;
            }

            if (String.IsNullOrEmpty(config["description"]))
            {
                config.Remove("description");
                config.Add("description", "db4o ASP.NET Profile provider");
            }

            base.Initialize(name, config);

            applicationName = Utils.DefaultIfBlank(config["applicationName"], HostingEnvironment.ApplicationVirtualPath);

            connectionString = ConnectionStringStore.GetConnectionString(config["connectionStringName"]);
            if (connectionString == null)
            {
                throw new ProviderException("Connection string cannot be blank.");
            }

            Db4oFactory.Configure().ObjectClass(new Profile("", "", false, DateTime.MinValue, DateTime.MinValue)).
            CascadeOnUpdate(true);
        }
        public override void Initialize(string name, NameValueCollection config)
        {
            throw new NotImplementedException();

            if (config == null)
            {
                throw new ArgumentNullException("config");
            }

            if (String.IsNullOrEmpty(name))
            {
                name = PROVIDER_NAME;
            }

            if (String.IsNullOrEmpty(config["description"]))
            {
                config.Remove("description");
                config.Add("description", "db4o ASP.NET Buffered Event provider");
            }

            base.Initialize(name, config);

            connectionString = ConnectionStringStore.GetConnectionString(config["connectionStringName"]);
            if (connectionString == null)
            {
                throw new ProviderException("Connection string cannot be blank.");
            }

            customInfo = new StringBuilder();

            providerName = name;
            buffer       = config.Get("buffer");
            bufferMode   = config.Get("bufferMode");

            customInfo.AppendLine(string.Format("Provider name: {0}", providerName));
            customInfo.AppendLine(string.Format("Buffering: {0}", buffer));
            customInfo.AppendLine(string.Format("Buffering modality: {0}", bufferMode));
        }
示例#3
0
        public override void Initialize(string name, NameValueCollection config)
        {
            if (config == null)
            {
                throw new ArgumentNullException("config");
            }

            if (string.IsNullOrEmpty(name))
            {
                name = PROVIDER_NAME;
            }

            if (String.IsNullOrEmpty(config["description"]))
            {
                config.Remove("description");
                config.Add("description", "db4o ASP.NET Membership Provider");
            }

            base.Initialize(name, config);

            applicationName = Utils.DefaultIfBlank(config["applicationName"], HostingEnvironment.ApplicationVirtualPath);

            connectionString = ConnectionStringStore.GetConnectionString(config["connectionStringName"]);
            if (connectionString == null)
            {
                throw new ProviderException("Connection string cannot be blank.");
            }

            maxInvalidPasswordAttempts           = Convert.ToInt32(Utils.DefaultIfBlank(config["maxInvalidPasswordAttempts"], "5"));
            passwordAttemptWindow                = Convert.ToInt32(Utils.DefaultIfBlank(config["passwordAttemptWindow"], "3"));
            minRequiredNonAlphanumericCharacters = Convert.ToInt32(Utils.DefaultIfBlank(config["minRequiredNonAlphanumericCharacters"], "0"));
            minRequiredPasswordLength            = Convert.ToInt32(Utils.DefaultIfBlank(config["minRequiredPasswordLength"], "4"));
            passwordStrengthRegularExpression    = Convert.ToString(Utils.DefaultIfBlank(config["passwordStrengthRegularExpression"], ""));
            enablePasswordReset       = Convert.ToBoolean(Utils.DefaultIfBlank(config["enablePasswordReset"], "true"));
            enablePasswordRetrieval   = Convert.ToBoolean(Utils.DefaultIfBlank(config["enablePasswordRetrieval"], "true"));
            requiresQuestionAndAnswer = Convert.ToBoolean(Utils.DefaultIfBlank(config["requiresQuestionAndAnswer"], "false"));
            requiresUniqueEmail       = Convert.ToBoolean(Utils.DefaultIfBlank(config["requiresUniqueEmail"], "true"));

            string tempPasswordFormat = config["passwordFormat"] ?? "Hashed";

            switch (tempPasswordFormat)
            {
            case "Hashed":
                passwordFormat = MembershipPasswordFormat.Hashed;
                break;

            case "Encrypted":
                passwordFormat = MembershipPasswordFormat.Encrypted;
                break;

            case "Clear":
                passwordFormat = MembershipPasswordFormat.Clear;
                break;

            default:
                throw new ProviderException("Password format not supported.");
            }

            if (ValidationKeyInfo.IsAutoGenerated() && (PasswordFormat != MembershipPasswordFormat.Clear))
            {
                throw new ProviderException("Hashed or Encrypted passwords are not supported with auto-generated keys.");
            }
        }