I\'ve created a custom IUserStore
for my application. I\'ve implemented the interfaces I need,
IUserStore,
I had the same problem and I don't want to implement the IUserTwoFactorStore
just to say that I don't implement it. But I also don't want to go back and muck around if I end up wanting to implement it (which I anticipate I will). So what I consider a future proof (and reusable) solution would be: (inspired by @gjsduarte's answer)
public class SafeUserManager : UserManager
{
public override Task GetTwoFactorEnabledAsync(TKey userId)
{
return Store is IUserTwoFactorStore
? base.GetTwoFactorEnabledAsync(userId)
: Task.FromResult(false);
}
}
It would probably be a good idea to do the same for the other Get[feature]EnabledAsync(TKey userId)
methods.