Aspnetcore.docs: Is there a difference in configuring in `services.Configure` or `services.AddIdentity`

Created on 26 May 2018  Â·  2Comments  Â·  Source: dotnet/AspNetCore.Docs

In this topic the 2.x version configures everything on the options parameter of services.Configure<IdentityOptions>(options =>, however the 2.x version in Introduction to Identity uses the options parameter of services.AddIdentity<ApplicationUser, IdentityRole>(options => which I suspect is the convention going forward. Does this need to be updated? Is there a reason to use one vs the other?


Document Details

⚠ Do not edit this section. It is required for docs.microsoft.com ➟ GitHub issue linking.

P1 Source - Docs.ms

Most helpful comment

@Rick-Anderson For clarification I'm talking about the options passed into the arrow method, not the generic parameters. There are two versions where the long list of settings are made like
options.Password.RequireDigit = true;
options.Lockout.AllowedForNewUsers = true;
(basically everything except for cookies which moved to services.ConfigureApplicationCookie()
In one version, everything happens in services.Configure<IdentityOptions>(options => and in another option settings are set in services.AddIdentity<ApplicationUser, IdentityRole>(options =>. If one is on track to be deprecated, it needs to be documented.

All 2 comments

@user135711 For ASP.NET Core 2.1, this is what the templates generate:
services.AddDefaultIdentity<IdentityUser>()

You're right, both topics need to be updated for 2.0 and 2.1.

The 2.0 templates generate

    services.AddIdentity<ApplicationUser, IdentityRole>()
        .AddEntityFrameworkStores<ApplicationDbContext>()
        .AddDefaultTokenProviders();

@Rick-Anderson For clarification I'm talking about the options passed into the arrow method, not the generic parameters. There are two versions where the long list of settings are made like
options.Password.RequireDigit = true;
options.Lockout.AllowedForNewUsers = true;
(basically everything except for cookies which moved to services.ConfigureApplicationCookie()
In one version, everything happens in services.Configure<IdentityOptions>(options => and in another option settings are set in services.AddIdentity<ApplicationUser, IdentityRole>(options =>. If one is on track to be deprecated, it needs to be documented.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

danroth27 picture danroth27  Â·  3Comments

davisnw picture davisnw  Â·  3Comments

royshouvik picture royshouvik  Â·  3Comments

aaron-bozit picture aaron-bozit  Â·  3Comments

nenmyx picture nenmyx  Â·  3Comments