The cookie does not expire when deploying the application in IIS. When doing the testing using VS + IIS Express, everything works as expected. Please see setup above.
In Startup:
app.UseCookieAuthentication(new CookieAuthenticationOptions
{
AuthenticationScheme = CookieAuthenticationDefaults.AuthenticationScheme,
AutomaticAuthenticate = true,
ExpireTimeSpan = TimeSpan.FromMinutes(3),
CookieSecure = env.IsDevelopment() ? CookieSecurePolicy.SameAsRequest :
CookieSecurePolicy.Always
});
In Controller:
var principal = new ClaimsPrincipal(new ClaimsIdentity(GetUserClaims(claims, response.ContentObject.Jwt, username), CookieName));
await HttpContext.Authentication.SignInAsync(CookieName, principal);