Reputation: 1696
I don't understand how to use the IOptions interface to configure the PasswordHasher
this doesn't build:
var passwordHasher = new PasswordHasher<User>(new PasswordHasherOptions() { CompatibilityMode = PasswordHasherCompatibilityMode.IdentityV2 });
Upvotes: 1
Views: 430
Reputation: 12196
Basically you're not returning the same type it expects.
Here is a typical example
public void ConfigureServices(IServiceCollection services)
{
services.Configure<PasswordHasherOptions>(opt =>
{
opt.CompatibilityMode = PasswordHasherCompatibilityMode.IdentityV2;
});
// Rest of ConfigureServices here
}
And for Azure Functions
public class Startup : FunctionsStartup
{
public override void Configure(IFunctionsHostBuilder builder)
{
builder.Services.Configure<PasswordHasherOptions>(opt =>
{
opt.CompatibilityMode = PasswordHasherCompatibilityMode.IdentityV2;
});
// Rest of Configure here
}
}
Upvotes: 2