I am trying to configure authentication to work with a custom provider. So far so good, I created a UserStore :
public class UserStore : IUserStore<User>, IUserPasswordStore<User>
(with all methods implemented) and UserManager:
public UserManager(IUserStore<User> userStore) : base(userStore) { }
and User is my user object for storing users.
The problem is that in UserStore I have the following:
public async Task SetPasswordHashAsync(User user, string passwordHash)
From what I understood, this is called before the user is created, so all I have to do is:
public Task SetPasswordHashAsync(User user, string passwordHash) { user.PasswordHash = passwordHash; }
... but this should return the task, and I don't see anything asynchronous here.
- Why return type is Task for
SetPasswordHashAsync and not just void? - How do I implement
SetPasswordHashAsync ?
I know I can do something like
public async Task SetPasswordHashAsync(User user, string passwordHash) { user.PasswordHash = passwordHash; await Task.FromResult(0); }
... but isn't it synchronous? It is strange to see all the other methods decorated with async Task, and use await , and this one, to return Task.FromResult()
Is anyone