Configured this way it is not working.
services
.AddAuthentication(CookieAuthenticationDefaults.AuthenticationScheme)
.AddCookie(options =>
{
options.ExpireTimeSpan = TimeSpan.FromMinutes(5);
options.LoginPath = $"/logon";
options.LogoutPath = $"/logoff";
options.AccessDeniedPath = $"/accessdenied";
options.SlidingExpiration = true;
})
configured this way it is working :
services.ConfigureApplicationCookie(options =>
{
options.Cookie.Name = "Caldr.Auth";
options.LoginPath = $"/logon";
options.LogoutPath = $"/logoff";
options.AccessDeniedPath = $"/accessdenied";
});
services
.AddAuthentication(CookieAuthenticationDefaults.AuthenticationScheme)
I would expect both to have the same behavior. Apprantly not. Bug or I did not got how to configure it ? :-)
Any thoughts.
At the time of posting my question I had identity framework configured/added too. So it might have been the mix of several factors that may it not work properly.
The working solution:
CONFIG:
The actual logon (i.e. writing the cookies is done via)
Take note of all the usages of CookieAuthenticationDefaults.AuthenticationScheme.