I am currently using Identity for a login system but the session token it creates offers a fixed expiry date of 10 hours. he spec for my system requires the session to expire if the user is idle for 20 minutes. I um unable to find anywhere in the source code to offer a rolling session state.
I have googled the issue and the only solution is to create a new session from the sessionAuthenticationModule every time the SessionAuthenticationModule_SessionSecurityTokenReceived event is raised in the global.asax.
if (validFrom.AddMinutes(halfSpan) < now && now < validTo)
{
var sam = sender as SessionAuthenticationModule;
e.SessionToken = sam.CreateSessionSecurityToken(
e.SessionToken.ClaimsPrincipal,
e.SessionToken.Context,
now,
now.AddMinutes(5),
e.SessionToken.IsPersistent);
e.ReissueCookie = true;
}
Is there a better alternative to this method?