MembershipProvider.cs 4.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293
  1. //
  2. // System.Web.Security.MembershipProvider
  3. //
  4. // Authors:
  5. // Ben Maurer ([email protected])
  6. // Lluis Sanchez Gual ([email protected])
  7. //
  8. // (C) 2003 Ben Maurer
  9. // Copyright (C) 2005 Novell, Inc (http://www.novell.com)
  10. //
  11. // Permission is hereby granted, free of charge, to any person obtaining
  12. // a copy of this software and associated documentation files (the
  13. // "Software"), to deal in the Software without restriction, including
  14. // without limitation the rights to use, copy, modify, merge, publish,
  15. // distribute, sublicense, and/or sell copies of the Software, and to
  16. // permit persons to whom the Software is furnished to do so, subject to
  17. // the following conditions:
  18. //
  19. // The above copyright notice and this permission notice shall be
  20. // included in all copies or substantial portions of the Software.
  21. //
  22. // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
  23. // EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
  24. // MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
  25. // NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
  26. // LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
  27. // OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
  28. // WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
  29. //
  30. #if NET_2_0
  31. using System.Configuration.Provider;
  32. namespace System.Web.Security
  33. {
  34. public abstract class MembershipProvider : ProviderBase
  35. {
  36. protected MembershipProvider ()
  37. {
  38. }
  39. public abstract bool ChangePassword (string name, string oldPwd, string newPwd);
  40. public abstract bool ChangePasswordQuestionAndAnswer (string name, string password, string newPwdQuestion, string newPwdAnswer);
  41. public abstract MembershipUser CreateUser (string username, string password, string email, string pwdQuestion, string pwdAnswer, bool isApproved, object providerUserKey, out MembershipCreateStatus status);
  42. public abstract bool DeleteUser (string name, bool deleteAllRelatedData);
  43. public abstract MembershipUserCollection FindUsersByEmail (string emailToMatch, int pageIndex, int pageSize, out int totalRecords);
  44. public abstract MembershipUserCollection FindUsersByName (string nameToMatch, int pageIndex, int pageSize, out int totalRecords);
  45. public abstract MembershipUserCollection GetAllUsers (int pageIndex, int pageSize, out int totalRecords);
  46. public abstract int GetNumberOfUsersOnline ();
  47. public abstract string GetPassword (string name, string answer);
  48. public abstract MembershipUser GetUser (string name, bool userIsOnline);
  49. public abstract MembershipUser GetUser (object providerUserKey, bool userIsOnline);
  50. public abstract string GetUserNameByEmail (string email);
  51. public abstract string ResetPassword (string name, string answer);
  52. public abstract void UpdateUser (MembershipUser user);
  53. public abstract bool ValidateUser (string name, string password);
  54. public abstract bool UnlockUser (string userName);
  55. public abstract string ApplicationName { get; set; }
  56. public abstract bool EnablePasswordReset { get; }
  57. public abstract bool EnablePasswordRetrieval { get; }
  58. public abstract bool RequiresQuestionAndAnswer { get; }
  59. public abstract int MaxInvalidPasswordAttempts { get; }
  60. public abstract int MinRequiredNonAlphanumericCharacters { get; }
  61. public abstract int MinRequiredPasswordLength { get; }
  62. public abstract int PasswordAttemptWindow { get; }
  63. public abstract MembershipPasswordFormat PasswordFormat { get; }
  64. public abstract string PasswordStrengthRegularExpression { get; }
  65. public abstract bool RequiresUniqueEmail { get; }
  66. protected virtual void OnValidatingPassword (ValidatePasswordEventArgs args)
  67. {
  68. if (ValidatingPassword != null)
  69. ValidatingPassword (this, args);
  70. }
  71. [MonoTODO]
  72. protected virtual byte[] DecryptPassword (byte[] encodedPassword)
  73. {
  74. throw new NotImplementedException ();
  75. }
  76. [MonoTODO]
  77. protected virtual byte[] EncryptPassword (byte[] password)
  78. {
  79. throw new NotImplementedException ();
  80. }
  81. public event MembershipValidatePasswordEventHandler ValidatingPassword;
  82. }
  83. }
  84. #endif