0
所以我有一个MVC5项目与ASP身份,我没有直接访问用户数据库,而是我提供的Web服务,例如:如何实现ASP身份IPasswordStore,如果我没有存储散列密码
bool register (string username, string password, string email) //password is plain text
bool login (string username, string password)
我的问题是,我不知道如何实现IUserPasswordStore因为ASP身份强迫我用哈希,而我不能存储哈希密码,因为这个Web服务将不只是我使用。
我UserStore.cs:
public Task<string> GetPasswordHashAsync(TUser user)
{
//I'm suppose to provide hashed password here, but since I don't have any hashed password stored, I have no idea how to implement this method
string passwordHash = userTable.GetPassword(user.Id);
return Task.FromResult<string>(passwordHash);
}
public Task<bool> HasPasswordAsync(TUser user)
{
var hasPassword = !string.IsNullOrEmpty(userTable.GetPassword(user.Id));
return Task.FromResult<bool>(Boolean.Parse(hasPassword.ToString()));
}
public Task SetPasswordHashAsync(TUser user, string passwordHash)
{
//do nothing since I don't need to hash the password
return Task.FromResult<Object>(null);
}