Я использую ASP.NET Identity с ядром ASP.NET, и у меня есть:
services.AddIdentity<User, Role>();
Это отлично работает, когда я вхожу в систему. Но затем я попробовал эту настройку:
services
.AddIdentity<User, Role>(x => {
x.Cookies = new IdentityCookieOptions {
ApplicationCookie = new CookieAuthenticationOptions {
AccessDeniedPath = new PathString("/signin"),
AuthenticationScheme = "cookies",
AutomaticAuthenticate = true,
AutomaticChallenge = true,
CookieName = "_ath",
LoginPath = new PathString("/signin"),
LogoutPath = new PathString("/signout")
}
};
})
.AddEntityFrameworkStores<Context, Int32>()
.AddDefaultTokenProviders();
При этом я получаю следующую ошибку:
No authentication handler is configured to handle the scheme:
Microsoft.AspNet.Identity.Application
Обратите внимание, что у меня есть AuthenticationScheme = "cookies"
, AutomaticAuthenticate = true
и AutomaticChallenge = true
.
У меня также есть следующее в методе Starttup/Configure:
applicationBuilder
.UseIdentity()
.UseMvc(routes => { routes.MapRoute(name: "default", template: "{controller=Home}/{action=Index}/{id?}"); })
Поэтому я полагаю, что использую порядок по умолчанию...
Кто-нибудь знает, что мне не хватает?