ASP MVC でカスタム MembershipProvider を使用して、アプリのコントローラーを保護しようとしています。
背景として、最終的には Web サービスを使用して各ユーザーを認証します。
私が理解しているように、次のようにルートレベルの web.config に追加します。
<authentication mode="Forms">
<forms loginUrl="~/Login/Login" timeout="2880" />
</authentication>
<membership defaultProvider="CustomMembershipProvider">
<providers>
<clear/>
<add name="MyMembershipProvider" type="DANet.security.MyMembershipProvider" />
</providers>
</membership>
そして、ここに私のクラスがあります:
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.Security;
namespace DANet.security
{
public class MyMembershipProvider : MembershipProvider
{
private static readonly log4net.ILog log = log4net.LogManager.GetLogger(System.Reflection.MethodBase.GetCurrentMethod().DeclaringType);
public override bool ValidateUser(string username, string password)
{
log.Debug("MyMembershipProvider");
throw new NotImplementedException();
}
public override MembershipUser CreateUser(string username,
string password, string email, string passwordQuestion,
string passwordAnswer, bool isApproved,
object providerUserKey, out MembershipCreateStatus status)
{
log.Debug("MyMembershipProvider");
throw new NotImplementedException();
}
public override string ApplicationName
{
get
{
throw new NotImplementedException();
}
set
{
throw new NotImplementedException();
}
}
public override bool ChangePassword(string username, string oldPassword, string newPassword)
{
log.Debug("MyMembershipProvider");
throw new NotImplementedException();
}
public override bool ChangePasswordQuestionAndAnswer(string username, string password, string newPasswordQuestion, string newPasswordAnswer)
{
log.Debug("MyMembershipProvider");
throw new NotImplementedException();
}
public override bool DeleteUser(string username, bool deleteAllRelatedData)
{
log.Debug("MyMembershipProvider");
throw new NotImplementedException();
}
public override bool EnablePasswordReset
{
get { throw new NotImplementedException(); }
}
public override bool EnablePasswordRetrieval
{
get { throw new NotImplementedException(); }
}
public override MembershipUserCollection FindUsersByEmail(string emailToMatch, int pageIndex, int pageSize, out int totalRecords)
{
log.Debug("MyMembershipProvider");
throw new NotImplementedException();
}
public override MembershipUserCollection FindUsersByName(string usernameToMatch, int pageIndex, int pageSize, out int totalRecords)
{
log.Debug("MyMembershipProvider");
throw new NotImplementedException();
}
public override MembershipUserCollection GetAllUsers(int pageIndex, int pageSize, out int totalRecords)
{
log.Debug("MyMembershipProvider");
throw new NotImplementedException();
}
public override int GetNumberOfUsersOnline()
{
log.Debug("MyMembershipProvider");
throw new NotImplementedException();
}
public override string GetPassword(string username, string answer)
{
log.Debug("MyMembershipProvider");
throw new NotImplementedException();
}
public override MembershipUser GetUser(string username, bool userIsOnline)
{
log.Debug("MyMembershipProvider");
throw new NotImplementedException();
}
public override MembershipUser GetUser(object providerUserKey, bool userIsOnline)
{
log.Debug("MyMembershipProvider");
throw new NotImplementedException();
}
public override string GetUserNameByEmail(string email)
{
log.Debug("MyMembershipProvider");
throw new NotImplementedException();
}
public override int MaxInvalidPasswordAttempts
{
get { throw new NotImplementedException(); }
}
public override int MinRequiredNonAlphanumericCharacters
{
get { throw new NotImplementedException(); }
}
public override int MinRequiredPasswordLength
{
get { throw new NotImplementedException(); }
}
public override int PasswordAttemptWindow
{
get { throw new NotImplementedException(); }
}
public override MembershipPasswordFormat PasswordFormat
{
get { throw new NotImplementedException(); }
}
public override string PasswordStrengthRegularExpression
{
get { throw new NotImplementedException(); }
}
public override bool RequiresQuestionAndAnswer
{
get { throw new NotImplementedException(); }
}
public override bool RequiresUniqueEmail
{
get { throw new NotImplementedException(); }
}
public override string ResetPassword(string username, string answer)
{
log.Debug("MyMembershipProvider");
throw new NotImplementedException();
}
public override bool UnlockUser(string userName)
{
log.Debug("MyMembershipProvider");
throw new NotImplementedException();
}
public override void UpdateUser(MembershipUser user)
{
log.Debug("MyMembershipProvider");
throw new NotImplementedException();
}
}
}
クラスがNETによって利用され、呼び出されているかどうかを確認したいだけです。ご覧のとおり、すべてのメソッドにログ ステートメントがあり、ログインしたとき、または [Authorize] とマークされたコントローラー メソッドを実行しようとしたときに、何もログに記録されません。何か不足していますか?