Andy Korneyev Andy Korneyev - 2 months ago 18
ASP.NET (C#) Question

ASP.NET5 beta8 IServiceCollection changes

After updating my project to recently released ASP.NET 5 beta8 I've found that

IServiceCollection
no longer contains definition for
ConfigureIdentity
and
ConfigureIdentityApplicationCookie
.

So previously written code like

services.ConfigureIdentity(o =>
{
o.Password.RequireUppercase = false;
o.Password.RequireNonLetterOrDigit = false;
});

services.ConfigureIdentityApplicationCookie(o => o.LoginPath = "/Admin/Users/Login");


can't be compiled anymore.

Google search brings no result, I suppose it is because only one day has passed since beta8 release.

Has anyone found workaround for this? How should identity options be configured in beta8?

Answer

The Configure* methods are removed and the Add* methods now accept an Action<TOptions>:

services.AddIdentity<TUser, TRole>(o =>
{
    o.Password.RequireUppercase = false;
    o.Password.RequireNonLetterOrDigit = false;
    o.Cookies.ApplicationCookie.LoginPath = "/Admin/Users/Login";
});

Not exactly, but partially related: https://github.com/aspnet/Announcements/issues/71

Comments