title: Reuse Claim in regenerateIdentityCallback in Owin Identity in MVC5
body: <p>I am using MVC5 with Owin identity.</p>
  
  <p>I am struggling to reuse any custom Claims in regenerateIdentityCallback.</p>
  
  <p>I have in Startup this configuration (as provided in the standard Template for new MVC project)</p>
  
  <pre><code>        app.UseCookieAuthentication(new CookieAuthenticationOptions
          {
              AuthenticationType = DefaultAuthenticationTypes.ApplicationCookie,
              LoginPath = new PathString("/Account/Login"),
              Provider = new CookieAuthenticationProvider
              {
                  OnValidateIdentity = SecurityStampValidator.OnValidateIdentity&lt;ApplicationUserManager, ApplicationUser, Guid&gt;(
                      validateInterval: TimeSpan.FromSeconds(10),
                      regenerateIdentityCallback: (manager, user) =&gt; user.GenerateUserIdentityAsync(manager),
                      getUserIdCallback: (user) =&gt; Guid.Parse(user.GetUserId()))
              }
          });
  </code></pre>
  
  <p>the GenerateUserIdentityAsync looks like this: (as well pretty much standard from the Template)</p>
  
  <pre><code>    public async Task&lt;ClaimsIdentity&gt; GenerateUserIdentityAsync(UserManager&lt;ApplicationUser, Guid&gt; manager)
      {
          var userIdentity = await manager.CreateIdentityAsync(this, DefaultAuthenticationTypes.ApplicationCookie);
  
          // I want here instead of generating new one, just reuse the previous one
          userIdentity.AddClaim(new Claim(ClaimTypes.Sid, Guid.NewGuid().ToString()));
  
          return userIdentity;
      }
  </code></pre>
  
  <p>The problem is, that I am not able to reuse the Claim and I allways have to get new value for it. After investigation of the Identity dll I see, that <code>this</code> instance of the user has no Claims as it is fresh user from Database and <code>userIdentity</code> has only the standard Claims as Id and UserName, which are created by CreateIdentityAsync method. Getting the user from HttpContext.Current is not possible, it is null on this place.</p>
  
  <p>What is the best way to reuse a Claim to keep some values from the Cookie? I probably misunderstood the purpose of Claims. Thx in advance for your help </p>