PageRenderTime 59ms CodeModel.GetById 34ms RepoModel.GetById 0ms app.codeStats 1ms

/Ximura Windows/Web/AuthModule/DigestMembershipProvider.cs

https://github.com/mbmccormick/Ximura
C# | 226 lines | 166 code | 39 blank | 21 comment | 0 complexity | 22926063160e0c704187681d84f494df MD5 | raw file
  1. #region using
  2. using System;
  3. using System.Collections.Generic;
  4. using System.Linq;
  5. using System.Text;
  6. using System.Web;
  7. using System.Web.Security;
  8. using CH = Ximura.Common;
  9. using System.Security.Principal;
  10. using System.Configuration;
  11. using System.Security.Permissions;
  12. #endregion // using
  13. namespace Ximura.Auth
  14. {
  15. /// <summary>
  16. /// This membership provider uses a digest based storage approach to user passwords.
  17. /// </summary>
  18. [AspNetHostingPermission(SecurityAction.InheritanceDemand, Level = AspNetHostingPermissionLevel.Minimal), AspNetHostingPermission(SecurityAction.LinkDemand, Level = AspNetHostingPermissionLevel.Minimal)]
  19. public class DigestMembershipProvider : MembershipProvider, IAuthenticationProviderDigest
  20. {
  21. #region Constructor
  22. /// <summary>
  23. /// This is the default constructor.
  24. /// </summary>
  25. public DigestMembershipProvider()
  26. {
  27. }
  28. #endregion // Constructor
  29. public override void Initialize(string name,
  30. System.Collections.Specialized.NameValueCollection config)
  31. {
  32. base.Initialize(name, config);
  33. }
  34. #region ApplicationName
  35. /// <summary>
  36. /// This is the application name and realm used for authentication.
  37. /// </summary>
  38. public override string ApplicationName
  39. {
  40. get;
  41. set;
  42. }
  43. #endregion // ApplicationName
  44. #region Realm
  45. /// <summary>
  46. /// This is the realm as reported to the client, and used in the hashing process.
  47. /// </summary>
  48. public virtual string Realm
  49. {
  50. get
  51. {
  52. return ApplicationName;
  53. }
  54. }
  55. #endregion // Realm
  56. public override bool ChangePassword(string username, string oldPassword, string newPassword)
  57. {
  58. throw new NotImplementedException();
  59. }
  60. public override bool ChangePasswordQuestionAndAnswer(string username, string password, string newPasswordQuestion, string newPasswordAnswer)
  61. {
  62. throw new NotImplementedException();
  63. }
  64. public override MembershipUser CreateUser(string username, string password,
  65. string email, string passwordQuestion, string passwordAnswer,
  66. bool isApproved, object providerUserKey, out MembershipCreateStatus status)
  67. {
  68. status = MembershipCreateStatus.ProviderError;
  69. return null;
  70. }
  71. public override bool DeleteUser(string username, bool deleteAllRelatedData)
  72. {
  73. return false;
  74. }
  75. public override bool EnablePasswordReset
  76. {
  77. get { return false; }
  78. }
  79. public override bool EnablePasswordRetrieval
  80. {
  81. get { return false; }
  82. }
  83. #region Find users
  84. public override MembershipUserCollection FindUsersByEmail(
  85. string emailToMatch, int pageIndex, int pageSize, out int totalRecords)
  86. {
  87. totalRecords = 0;
  88. return new MembershipUserCollection();
  89. }
  90. public override MembershipUserCollection FindUsersByName(
  91. string usernameToMatch, int pageIndex, int pageSize, out int totalRecords)
  92. {
  93. totalRecords = 0;
  94. return new MembershipUserCollection();
  95. }
  96. public override MembershipUserCollection GetAllUsers(
  97. int pageIndex, int pageSize, out int totalRecords)
  98. {
  99. totalRecords = 0;
  100. return new MembershipUserCollection();
  101. }
  102. #endregion // Find users
  103. public override int GetNumberOfUsersOnline()
  104. {
  105. return 0;
  106. }
  107. #region GetPassword(string username, string answer)
  108. /// <summary>
  109. /// This method is not supported.
  110. /// </summary>
  111. /// <param name="username"></param>
  112. /// <param name="answer"></param>
  113. /// <returns></returns>
  114. public override string GetPassword(string username, string answer)
  115. {
  116. throw new NotSupportedException("Password retrieval is not uspported.");
  117. }
  118. #endregion // GetPassword(string username, string answer)
  119. #region Find user
  120. public override MembershipUser GetUser(string username, bool userIsOnline)
  121. {
  122. throw new NotImplementedException();
  123. }
  124. public override MembershipUser GetUser(object providerUserKey, bool userIsOnline)
  125. {
  126. throw new NotImplementedException();
  127. }
  128. #endregion // Find user
  129. public override string GetUserNameByEmail(string email)
  130. {
  131. throw new NotImplementedException();
  132. }
  133. public override int MaxInvalidPasswordAttempts
  134. {
  135. get { throw new NotImplementedException(); }
  136. }
  137. public override int MinRequiredNonAlphanumericCharacters
  138. {
  139. get { throw new NotImplementedException(); }
  140. }
  141. public override int MinRequiredPasswordLength
  142. {
  143. get { throw new NotImplementedException(); }
  144. }
  145. public override int PasswordAttemptWindow
  146. {
  147. get { throw new NotImplementedException(); }
  148. }
  149. #region PasswordFormat
  150. /// <summary>
  151. /// This method specifies that the password is hashed.
  152. /// </summary>
  153. public override MembershipPasswordFormat PasswordFormat
  154. {
  155. get { return MembershipPasswordFormat.Hashed; }
  156. }
  157. #endregion // PasswordFormat
  158. public override string PasswordStrengthRegularExpression
  159. {
  160. get { throw new NotImplementedException(); }
  161. }
  162. public override bool RequiresQuestionAndAnswer
  163. {
  164. get { throw new NotImplementedException(); }
  165. }
  166. public override bool RequiresUniqueEmail
  167. {
  168. get { return true; }
  169. }
  170. public override string ResetPassword(string username, string answer)
  171. {
  172. throw new NotImplementedException();
  173. }
  174. public override bool UnlockUser(string userName)
  175. {
  176. throw new NotImplementedException();
  177. }
  178. public override void UpdateUser(MembershipUser user)
  179. {
  180. throw new NotImplementedException();
  181. }
  182. public override bool ValidateUser(string username, string password)
  183. {
  184. throw new NotImplementedException();
  185. }
  186. }
  187. }