How do I invalidate a session?
Repro:
- Login using a normal account
- Export cookies associated with my site
- Click the logout button
- Confirm that I'm logged out of the site, the cookie is cleared
- Import the cookies copied from step 2
- I'm now logged into the site again without having to go through the login process
Is there anyway to make the cookies previously copied invalid?
I'm using the standard MVC5 logoff function.
public ActionResult LogOff()
{
AuthenticationManager.SignOut();
return RedirectToAction("Index", "Home");
}
private IAuthenticationManager AuthenticationManager
{
get
{
return HttpContext.GetOwinContext().Authentication;
}
}
Also tried signing out just the cookie.
AuthenticationManager.SignOut(DefaultAuthenticationTypes.ApplicationCookie);
Thought changing the SecurityStamp would also work but since the claim hasn't changed, the stamp doesn't either.
UserManager.UpdateSecurityStampAsync(user.UserName);
I've also tried this function which the documentation says should invalidate the session. http://msdn.microsoft.com/en-us/library/system.web.sessionstate.httpsessionstate.abandon(v=vs.110).aspx
Session.Abandon();