Many hyperlinks are disabled.
Use anonymous login
to enable hyperlinks.
Overview
Comment: | Made things threadsafe as they should have been to begin with. |
---|---|
Downloads: | Tarball | ZIP archive |
Timelines: | family | ancestors | descendants | both | sourceforge |
Files: | files | file ages | folders |
SHA1: |
e5c3ca2b22f1347a2ba6f288bd9efd2c |
User & Date: | jeffreyabecker 2006-03-02 02:34:23.000 |
Context
2006-03-02
| ||
18:02 | 1.0.27.1 check-in: bd1f4f5d01 user: rmsimpson tags: sourceforge | |
02:34 | Made things threadsafe as they should have been to begin with. check-in: e5c3ca2b22 user: jeffreyabecker tags: sourceforge | |
2006-03-01
| ||
22:40 | updated membership to have sane defaults check-in: de05d61657 user: jeffreyabecker tags: sourceforge | |
Changes
Changes to Membership/MembershipProvider/Initialize.cs.
︙ | ︙ | |||
15 16 17 18 19 20 21 22 23 | namespace SQLiteProvider { public sealed partial class SQLiteMembershipProvider : MembershipProvider { public override void Initialize(string name, NameValueCollection config) { | > > > > > | < | < > | | | | | | | | | | | | | | | | | | | | | | | > | | | | < | < < < < < < < < < < | | > | | | | | | | | | | | | | < < | > > > > > > > > > > > > > > > > | 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 | namespace SQLiteProvider { public sealed partial class SQLiteMembershipProvider : MembershipProvider { private bool _initialized = false; private Object _InitLock = new Object(); public override void Initialize(string name, NameValueCollection config) { bool te = _initialized; if (te) return; lock (_InitLock) { if (config == null) throw new ArgumentNullException("config"); if (name == null || name.Length == 0) name = "SQLiteMembershipProvider"; if (String.IsNullOrEmpty(config["description"])) { config.Remove("description"); config.Add("description", "SQLite Membership provider"); } // Initialize the abstract base class. base.Initialize(name, config); _MaxInvalidPasswordAttempts = ConfigAsInt32(config["maxInvalidPasswordAttempts"], 5); _PasswordAttemptWindow = ConfigAsInt32(config["passwordAttemptWindow"], 10); _MinRequiredNonAlphanumericCharacters = ConfigAsInt32(config["minRequiredNonAlphanumericCharacters"], 0); _MinRequiredPasswordLength = ConfigAsInt32(config["minRequiredPasswordLength"], 7); _PasswordStrengthRegularExpression = ConfigAsString(config["passwordStrengthRegularExpression"], ""); _EnablePasswordReset = ConfigAsBoolean(config["enablePasswordReset"], true); _EnablePasswordRetrieval = ConfigAsBoolean(config["enablePasswordRetrieval"], false); _RequiresQuestionAndAnswer = ConfigAsBoolean(config["requiresQuestionAndAnswer"], false); _RequiresUniqueEmail = ConfigAsBoolean(config["requiresUniqueEmail"], true); string temp_format = Convert.ToString(ConfigAsString(config["passwordFormat"], "Hashed")); try { _PasswordFormat = (MembershipPasswordFormat)Enum.Parse(MembershipPasswordFormat, temp_format); } catch { throw new ProviderException("Invalid Password Format."); } _WriteExceptionsToEventLog = ProviderUtility.GetExceptionDesitination(config["writeExceptionsToEventLog"]); connectionString = ProviderUtility.GetConnectionString(config["connectionStringName"]); ApplicationName = ProviderUtility.GetApplicationName(config["applicationName"]); // Get encryption and decryption key information from the configuration. Configuration cfg = WebConfigurationManager.OpenWebConfiguration(System.Web.Hosting.HostingEnvironment.ApplicationVirtualPath); machineKey = (MachineKeySection)cfg.GetSection("system.web/machineKey"); if (machineKey.ValidationKey.Contains("AutoGenerate")) if (PasswordFormat != MembershipPasswordFormat.Clear) throw new ProviderException("Hashed or Encrypted passwords are not supported with auto-generated keys."); _initialized = true; } } // // A helper function to retrieve config values from the configuration file. // private string ConfigAsString(string configValue, string defaultValue) { if (String.IsNullOrEmpty(configValue)) return defaultValue; return configValue; } private bool ConfigAsBoolean(string configValue, bool defaultValue){ if (String.IsNullOrEmpty(configValue)) return defaultValue; return Convert.ToBoolean(configValue); } private Int32 ConfigAsInt32(string configValue, int defaultValue) { if (String.IsNullOrEmpty(configValue)) return defaultValue; return Convert.ToInt32(configValue); } } } |
Changes to Membership/MembershipProvider/ProviderProperties.cs.
︙ | ︙ | |||
16 17 18 19 20 21 22 23 24 25 26 27 | namespace SQLiteProvider { public sealed partial class SQLiteMembershipProvider : MembershipProvider { public override string ApplicationName { get { return _ApplicationName; } set { | > > > | | > | 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 | namespace SQLiteProvider { public sealed partial class SQLiteMembershipProvider : MembershipProvider { private Object _appLock = new Object(); public override string ApplicationName { get { return _ApplicationName; } set { lock (_appLock) { _ApplicationName = value; _AppID = ProviderUtility.GetApplicationID(connectionString, value); } } } public override bool EnablePasswordReset { get { return _EnablePasswordReset; } } |
︙ | ︙ |
Changes to Membership/RoleProvider/RoleProvider.cs.
︙ | ︙ | |||
18 19 20 21 22 23 24 | public sealed partial class SQLiteRoleProvider : RoleProvider { private string eventSource = "SQLiteRoleProvider"; private string connectionString; | < < > > > > < < < < < < < > > > < | < | > | | | | | | | | | | | < < < < | | | < | | | < < < < < < < < > > | | | | | < < < < < < < < < < < < < | 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 | public sealed partial class SQLiteRoleProvider : RoleProvider { private string eventSource = "SQLiteRoleProvider"; private string connectionString; private bool _WriteExceptionsToEventLog = false; private string _ApplicationName; private long _AppID; private bool _initialized = false; private object _InitLock = new Object(); private object _AppLock = new Object(); public bool WriteExceptionsToEventLog { get { return _WriteExceptionsToEventLog; } } public override void Initialize(string name, NameValueCollection config) { bool TempInit = _initialized; if (_initialized) return; lock (_InitLock) { if (config == null) throw new ArgumentNullException("config"); if (name == null || name.Length == 0) name = "SQLiteRoleProvider"; if (String.IsNullOrEmpty(config["description"])) { config.Remove("description"); config.Add("description", "SQLite Role Privider"); } // Initialize the abstract base class. base.Initialize(name, config); _WriteExceptionsToEventLog = ProviderUtility.GetExceptionDesitination(config["writeExceptionsToEventLog"]); connectionString = ProviderUtility.GetConnectionString(config["connectionStringName"]); ApplicationName = ProviderUtility.GetApplicationName(config["applicationName"]); _initialized = true; } } public override string ApplicationName { get { return _ApplicationName; } set { lock (_AppLock) { _ApplicationName = value; _AppID = ProviderUtility.GetApplicationID(connectionString, value); } } } public override void AddUsersToRoles(string[] usernames, string[] rolenames) { foreach (string rolename in rolenames) { if (!RoleExists(rolename)) { throw new ProviderException("Role name not found."); } } foreach (string username in usernames) { foreach (string rolename in rolenames) { if (IsUserInRole(username, rolename)) { throw new ProviderException("User is already in role."); } } |
︙ | ︙ | |||
165 166 167 168 169 170 171 | } finally { conn.Close(); } } | < < < < < < < < < < < | 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 | } finally { conn.Close(); } } public override void CreateRole(string rolename) { if (RoleExists(rolename)) { throw new ProviderException("Role name already exists."); } SQLiteConnection conn = new SQLiteConnection(connectionString); SQLiteCommand cmd = new SQLiteCommand(RoleSql.CreateRole, conn); |
︙ | ︙ | |||
205 206 207 208 209 210 211 | } finally { conn.Close(); } } | < < < < < < | 167 168 169 170 171 172 173 174 175 176 177 178 179 180 | } finally { conn.Close(); } } public override bool DeleteRole(string rolename, bool throwOnPopulatedRole) { if (!RoleExists(rolename)) { throw new ProviderException("Role does not exist."); } |
︙ | ︙ | |||
266 267 268 269 270 271 272 | finally { conn.Close(); } return true; } | < < < < < < | 222 223 224 225 226 227 228 229 230 231 232 233 234 235 | finally { conn.Close(); } return true; } public override string[] GetAllRoles() { List<String> names = new List<string>(); SQLiteConnection conn = new SQLiteConnection(connectionString); SQLiteCommand cmd = new SQLiteCommand(RoleSql.GetAllRoles, conn); cmd.Parameters.Add("$AppID", DbType.Int64).Value = _AppID; |
︙ | ︙ | |||
306 307 308 309 310 311 312 | if (reader != null) { reader.Close(); } conn.Close(); } return names.ToArray(); } | < < < < < < | 256 257 258 259 260 261 262 263 264 265 266 267 268 269 | if (reader != null) { reader.Close(); } conn.Close(); } return names.ToArray(); } public override string[] GetRolesForUser(string username) { List<string> roles = new List<string>(); SQLiteConnection conn = new SQLiteConnection(connectionString); SQLiteCommand cmd = new SQLiteCommand(RoleSql.GetRolesForUser, conn); |
︙ | ︙ | |||
348 349 350 351 352 353 354 | if (reader != null) { reader.Close(); } conn.Close(); } return roles.ToArray(); } | < < < < < < | 292 293 294 295 296 297 298 299 300 301 302 303 304 305 | if (reader != null) { reader.Close(); } conn.Close(); } return roles.ToArray(); } public override string[] GetUsersInRole(string rolename) { List<String> users = new List<string>(); SQLiteConnection conn = new SQLiteConnection(connectionString); SQLiteCommand cmd = new SQLiteCommand(RoleSql.GetUsersInRole, conn); |
︙ | ︙ | |||
388 389 390 391 392 393 394 | finally { if (reader != null) { reader.Close(); } conn.Close(); } return users.ToArray(); } | < < < < < < | 326 327 328 329 330 331 332 333 334 335 336 337 338 339 | finally { if (reader != null) { reader.Close(); } conn.Close(); } return users.ToArray(); } public override bool IsUserInRole(string username, string rolename) { long count = 0; SQLiteConnection conn = new SQLiteConnection(connectionString); SQLiteCommand cmd = new SQLiteCommand(RoleSql.IsUserInRole, conn); |
︙ | ︙ | |||
421 422 423 424 425 426 427 | finally { conn.Close(); } return (count != 0); } | < < < < < < | 353 354 355 356 357 358 359 360 361 362 363 364 365 366 | finally { conn.Close(); } return (count != 0); } public override void RemoveUsersFromRoles(string[] usernames, string[] rolenames) { foreach (string rolename in rolenames) { if (!RoleExists(rolename)) { throw new ProviderException("Role name not found."); |
︙ | ︙ | |||
491 492 493 494 495 496 497 | } finally { conn.Close(); } } | < < < < < < | 417 418 419 420 421 422 423 424 425 426 427 428 429 430 | } finally { conn.Close(); } } public override bool RoleExists(string rolename) { long count = 0; SQLiteConnection conn = new SQLiteConnection(connectionString); SQLiteCommand cmd = new SQLiteCommand(RoleSql.RoleExists, conn); |
︙ | ︙ | |||
525 526 527 528 529 530 531 | finally { conn.Close(); } return (count != 0); } | < < < < < | 445 446 447 448 449 450 451 452 453 454 455 456 457 458 | finally { conn.Close(); } return (count != 0); } public override string[] FindUsersInRole(string rolename, string usernameToMatch) { SQLiteConnection conn = new SQLiteConnection(connectionString); SQLiteCommand cmd = new SQLiteCommand(RoleSql.FindUsersInRole, conn); cmd.Parameters.Add("$Username", DbType.String).Value = usernameToMatch; cmd.Parameters.Add("$Rolename", DbType.String).Value = rolename; cmd.Parameters.Add("$AppID", DbType.Int64).Value = _AppID; |
︙ | ︙ | |||
566 567 568 569 570 571 572 | if (reader != null) { reader.Close(); } conn.Close(); } return users.ToArray(); } | < < | 481 482 483 484 485 486 487 488 489 490 491 492 | if (reader != null) { reader.Close(); } conn.Close(); } return users.ToArray(); } } } |
Changes to Membership/SQLiteProvider.suo.
cannot compute difference between binary files