title: Setting expiration for cookie on claims based authentication
body: <p>I got an standard MVC5 web app with a somewhat modified login from the template.</p>
  
  <p>Im trying to set a 30 minute expiration on the cookie that is created when I login</p>
  
  <p>Here is my login action</p>
  
  <pre><code>    [HttpPost]
      [AllowAnonymous]
      [ValidateAntiForgeryToken]
      public async Task&lt;ActionResult&gt; Login(LoginViewModel model, string returnUrl)
      {
          var user = AccountDomain.CheckUserLogin(model.UserName, model.Password);
  
          if (user != null)
          {
              AuthenticationManager.SignOut(DefaultAuthenticationTypes.ExternalCookie);
  
              var claims = new List&lt;Claim&gt;
              {
                  new Claim("UserName", user.UserName),
                  new Claim("FirstName", user.FirstName ?? ""),
                  new Claim("LastName", user.LastName ?? "")
              };
  
              var identity = new ClaimsIdentity(claims, DefaultAuthenticationTypes.ApplicationCookie);
  
              var claimsPrincipal = new ClaimsPrincipal(identity);
  
              Thread.CurrentPrincipal = claimsPrincipal;
  
              AuthenticationManager.SignIn(new AuthenticationProperties() { IsPersistent = model.RememberMe }, identity);
  
              return RedirectToLocal(returnUrl);
          }
          else
          {
              ModelState.AddModelError("", "Invalid username or password.");
          }
  
          return View(model);
      }
  </code></pre>
  
  <p>i tried doing this</p>
  
  <pre><code>var exp = new DateTimeOffset().AddMinutes(5);
  AuthenticationManager.SignIn(new AuthenticationProperties() { IsPersistent = model.RememberMe, ExpiresUtc = exp }, identity);
  </code></pre>
  
  <p>but the cookie states expiration: When the browsing session ends</p>
  
  <p>If 'remember me' is checked on the login page, then IsPersistent will be true and will set the expiration of the cookie to 14 days from login time.</p>
  
  <p>How can i set the expiration time of the cookie manually?</p>