Removed debug noise
[mono.git] / mcs / class / System.Web / System.Web.Security / SqliteMembershipProvider.cs
index 241cfa5e7e508992075fbc8d245deaa42c3add80..2acff57210e70b2f1999f230438a1cf9db361550 100644 (file)
@@ -48,13 +48,13 @@ namespace System.Web.Security
 {
        internal class SqliteMembershipProvider : MembershipProvider
        {
-               private const string m_TableName = "Users";
-               private string m_ConnectionString = string.Empty;
-               private const int m_NewPasswordLength = 8;
-               private bool machineKeyIsAutoGenerated;
+               const string m_TableName = "Users";
+               string m_ConnectionString = string.Empty;
+               const int m_NewPasswordLength = 8;
+               bool machineKeyIsAutoGenerated;
                
                // Used when determining encryption key values.
-               private MachineKeySection m_MachineKey = null;
+               MachineKeySection m_MachineKey = null;
 
                DbParameter AddParameter (DbCommand command, string parameterName, object parameterValue)
                 {
@@ -70,17 +70,6 @@ namespace System.Web.Security
                         command.Parameters.Add (dbp);
                         return dbp;
                 }
-
-                DbParameter AddParameter (DbCommand command, string parameterName, ParameterDirection direction, DbType type, object parameterValue)
-                {
-                        DbParameter dbp = command.CreateParameter ();
-                        dbp.ParameterName = parameterName;
-                        dbp.Value = parameterValue;
-                        dbp.Direction = direction;
-                        dbp.DbType = type;
-                        command.Parameters.Add (dbp);
-                        return dbp;
-                }
                
                /// <summary>
                /// System.Configuration.Provider.ProviderBase.Initialize Method.
@@ -151,8 +140,7 @@ namespace System.Web.Security
                        }
 
                        // Get encryption and decryption key information from the configuration.
-                       System.Configuration.Configuration cfg = WebConfigurationManager.OpenWebConfiguration(HostingEnvironment.ApplicationVirtualPath);
-                       m_MachineKey = (MachineKeySection)cfg.GetSection("system.web/machineKey");
+                       m_MachineKey = (MachineKeySection)WebConfigurationManager.GetSection("system.web/machineKey", null);
 
                        if (!m_PasswordFormat.Equals(MembershipPasswordFormat.Clear))
                        {
@@ -171,17 +159,17 @@ namespace System.Web.Security
                /// System.Web.Security.MembershipProvider properties.
                /// </summary>
                #region System.Web.Security.MembershipProvider properties
-               private string m_ApplicationName = string.Empty;
-               private bool m_EnablePasswordReset = false;
-               private bool m_EnablePasswordRetrieval = false;
-               private bool m_RequiresQuestionAndAnswer = false;
-               private bool m_RequiresUniqueEmail = false;
-               private int m_MaxInvalidPasswordAttempts = 0;
-               private int m_PasswordAttemptWindow = 0;
-               private MembershipPasswordFormat m_PasswordFormat = MembershipPasswordFormat.Clear;
-               private int m_MinRequiredNonAlphanumericCharacters = 0;
-               private int m_MinRequiredPasswordLength = 0;
-               private string m_PasswordStrengthRegularExpression = string.Empty;
+               string m_ApplicationName = string.Empty;
+               bool m_EnablePasswordReset = false;
+               bool m_EnablePasswordRetrieval = false;
+               bool m_RequiresQuestionAndAnswer = false;
+               bool m_RequiresUniqueEmail = false;
+               int m_MaxInvalidPasswordAttempts = 0;
+               int m_PasswordAttemptWindow = 0;
+               MembershipPasswordFormat m_PasswordFormat = MembershipPasswordFormat.Clear;
+               int m_MinRequiredNonAlphanumericCharacters = 0;
+               int m_MinRequiredPasswordLength = 0;
+               string m_PasswordStrengthRegularExpression = string.Empty;
 
                public override string ApplicationName
                {
@@ -1326,7 +1314,7 @@ namespace System.Web.Security
                /// <param name="configValue"></param>
                /// <param name="defaultValue"></param>
                /// <returns></returns>
-               private string GetConfigValue(string configValue, string defaultValue)
+               string GetConfigValue(string configValue, string defaultValue)
                {
                        if (string.IsNullOrEmpty(configValue))
                                return defaultValue;
@@ -1341,7 +1329,7 @@ namespace System.Web.Security
                /// </summary>
                /// <param name="reader">SqliteDataReader object</param>
                /// <returns>MembershipUser object</returns>
-               private MembershipUser GetUserFromReader(SqliteDataReader reader)
+               MembershipUser GetUserFromReader(SqliteDataReader reader)
                {
                        object providerUserKey = reader.GetValue(0);
                        string username = reader.GetString(1);
@@ -1395,7 +1383,7 @@ namespace System.Web.Security
                /// <param name="password"></param>
                /// <param name="dbpassword"></param>
                /// <returns></returns>
-               private bool CheckPassword(string password, string dbpassword)
+               bool CheckPassword(string password, string dbpassword)
                {
                        string pass1 = password;
                        string pass2 = dbpassword;
@@ -1425,7 +1413,7 @@ namespace System.Web.Security
                /// </summary>
                /// <param name="password"></param>
                /// <returns></returns>
-               private string EncodePassword(string password)
+               string EncodePassword(string password)
                {
                        if (string.IsNullOrEmpty(password))
                                return password;
@@ -1444,7 +1432,7 @@ namespace System.Web.Security
                                case MembershipPasswordFormat.Hashed:
                                        HMACSHA1 hash = new HMACSHA1();
                                        if (machineKeyIsAutoGenerated)
-                                               hash.Key = MachineKeySectionUtils.ValidationKeyBytes ();
+                                               hash.Key = MachineKeySection.Config.GetValidationKey ();
                                        else
                                                hash.Key = HexToByte(m_MachineKey.ValidationKey);
                                        encodedPassword = Convert.ToBase64String(hash.ComputeHash(Encoding.Unicode.GetBytes(password)));
@@ -1462,7 +1450,7 @@ namespace System.Web.Security
                /// </summary>
                /// <param name="encodedPassword"></param>
                /// <returns></returns>
-               private string UnEncodePassword(string encodedPassword)
+               string UnEncodePassword(string encodedPassword)
                {
                        string password = encodedPassword;
 
@@ -1491,7 +1479,7 @@ namespace System.Web.Security
                /// </summary>
                /// <param name="hexString"></param>
                /// <returns></returns>
-               private byte[] HexToByte(string hexString)
+               byte[] HexToByte(string hexString)
                {
                        byte[] returnBytes = new byte[hexString.Length / 2];
                        for (int i = 0; i < returnBytes.Length; i++)
@@ -1506,7 +1494,7 @@ namespace System.Web.Security
                /// </summary>
                /// <param name="username"></param>
                /// <param name="failType"></param>
-               private void UpdateFailureCount(string username, FailureType failType)
+               void UpdateFailureCount(string username, FailureType failType)
                {
                        DateTime windowStart = new DateTime();
                        int failureCount = 0;
@@ -1640,7 +1628,7 @@ namespace System.Web.Security
                        }
                }
 
-               private enum FailureType
+               enum FailureType
                {
                        Password,
                        PasswordAnswer