title: How to add custom data to claim during login process?
body: <p>I was reading article from <a href="http://kevin-junghans.blogspot.in/2013/12/using-claims-in-aspnet-identity.html" rel="nofollow">here</a></p>
  
  <p>This way we can add claim during login</p>
  
  <pre><code>var user = userManager.Find(userName, password);
  identity.AddClaim(new Claim(ClaimTypes.Email, user.Email));
  AuthenticationManager.SignIn(new AuthenticationProperties() { IsPersistent = persistCookie }, identity);
  </code></pre>
  
  <p>This way reading back the value stored in clam</p>
  
  <pre><code>var prinicpal = (ClaimsPrincipal)Thread.CurrentPrincipal;
  var email = prinicpal.Claims.Where(c =&gt; c.Type == ClaimTypes.Email).Select(c =&gt; c.Value).SingleOrDefault();
  </code></pre>
  
  <h2>Now I have few questions</h2>
  
  <ol>
  <li><p>How could I add my custom data to claim. Suppose user role names.
  Suppose the things I want to add that is not available in <code>ClaimTypes</code> then how could I add my custom data to claim?</p></li>
  <li><p>How to read back my custom data stored in claim?</p></li>
  <li><p>My action is decorated with authorized attribute where role name is specified like below one:</p></li>
  </ol>
  
  <p>..</p>
  
  <pre><code> public class HomeController : Controller
   {
       [Authorize(Roles = "Admin, HrAdmin")]
       public ActionResult PayRoll()
       {
           return View();
       }
    }
  </code></pre>
  
  <p>Do I need to go for custom authentication to extract roles from claim to set in <code>GenericPrincipal</code>?</p>
  
  <p>Last question: When we go for role based authorization then roles are stored in authorization cookie? Do I need to write code to store roles in authorization cookie or ASP.net engine does it for us?</p>
  
  <p>Same way claims are store in authorization cookie generated by owin cookie?</p>