-
Notifications
You must be signed in to change notification settings - Fork 10.5k
Closed
Labels
Needs: Author FeedbackThe author of this issue needs to respond in order for us to continue investigating this issue.The author of this issue needs to respond in order for us to continue investigating this issue.Needs: ReproIndicates that the team needs a repro project to continue the investigation on this issueIndicates that the team needs a repro project to continue the investigation on this issueStatus: No Recent Activityarea-identityIncludes: Identity and providersIncludes: Identity and providers
Description
Hello,
I use .net core identity for authentication and authorization in my project. I set .AspNetCore.Identity.Application cookie's expiration date after 30 days in controller:
var checkPasswordResult =
await _signInManager.CheckPasswordSignInAsync(user, model.Password, lockoutOnFailure: true);
if (checkPasswordResult.Succeeded)
{
var authenticationProperties = new AuthenticationProperties();
if (model.RememberMe)
{
authenticationProperties.IsPersistent = true;
authenticationProperties.ExpiresUtc = DateTimeOffset.UtcNow.AddDays(30);
authenticationProperties.AllowRefresh = true;
}
await _signInManager.SignInAsync(user, authenticationProperties);
}And my Startup:
services.AddAuthentication(IdentityConstants.ApplicationScheme)
.AddCookie(options =>
{
options.LoginPath = "/Account/LogIn";
options.LogoutPath = "/Account/LogOut";
options.AccessDeniedPath = "/Account/AccessDenied";
options.ExpireTimeSpan = TimeSpan.FromDays(30);
options.SlidingExpiration = true;
});After login I can see it is set correctly:

Somehow, when I close browser and open it after 30 minutes, .AspNetCore.Identity.Application cookie is being deleted. I checked it in my local in production environment and I saw that cookie is not being deleted.
I don't have any custom middleware which will effect this cookie and I don't have any custom configuration which will delete any cookie after any minutes in server.
Metadata
Metadata
Assignees
Labels
Needs: Author FeedbackThe author of this issue needs to respond in order for us to continue investigating this issue.The author of this issue needs to respond in order for us to continue investigating this issue.Needs: ReproIndicates that the team needs a repro project to continue the investigation on this issueIndicates that the team needs a repro project to continue the investigation on this issueStatus: No Recent Activityarea-identityIncludes: Identity and providersIncludes: Identity and providers