title: ASP.NET Identity, persistent cookie - is something like this build in?
body: <p>We are using <strong>CookieAuthenticationProvider</strong> and would like to implement the <strong>'Remember me'</strong> functionality in our application that would work like this:</p>
  
  <ol>
  <li><p>No matter if the <strong>'Remember me'</strong> checkbox is checked or not, <strong>the token expiration time should always be set to 30 minutes</strong> (with SlidingExpiration turned on)</p></li>
  <li><p>If user doesn't check 'Remember me' all we do is check if token expired - if it did, then user is redirected to login screen (this is build in into OWIN and works fine)</p></li>
  <li><p>However if user checks 'Remember me' his credentials should be saved in the <strong>additional</strong> cookie (with default lifetime of 30 days). If his token expires (the timeout should still be set to 30 minutes), <strong>OWIN should use that additional cookie to renew the token automatically in the background</strong>. So in other words - if user check 'Remember me' he should be logged in for 30 days or until he logs out.</p></li>
  </ol>
  
  <p>Question is - how can something like this be done with OWIN? As far as I can see, the default implementation still uses <strong>ExpireTimeSpan</strong> parameter - the only difference is, that the cookie is marked as persistent, so if user restarts browser he is logged in - but token expiration is still limited by ExpireTimeSpan. </p>
  
  <p>I guess I have to somehow manually save user credentials during the <strong>SignIn</strong> and override the <strong>OnApplyRedirect</strong> event (that seems to be the only event fired if an unauthorized user tries to access a view that requires authorization), and instead of redirecting, somehow regenerate user's token... but does anybody know how exactly to do that?</p>