title: Add Custom Claim Types
body: <p>New to OWIN authentication and finding it hard to create my own owin claim types.</p>
  
  <p>Heres the thing. I need to add custom claims like "GroupID" so i can easily access it on the different pages.</p>
  
  <p>I did something like this in my Login</p>
  
  <pre><code>public ActionResult Login(LoginViewModel model, string returnUrl)
  {
      UserViewModel userModel = new UserViewModel();
      if (!ModelState.IsValid)
      {
          return View(model);
      }
  
      if(CommonHelper.ValidateADUser(model.Username,model.Password))
      {
  
          UserViewModel curUser = userModel.GetUserDetails(model.Username);
          if (curUser != null)
          {
              var claims = new List&lt;Claim&gt;();
              claims.Add(new Claim(ClaimTypes.WindowsAccountName, curUser.Username));
              claims.Add(new Claim(ClaimTypes.Name,curUser.Fullname));
              claims.Add(new Claim(ClaimTypes.Role, ""));
              claims.Add(new Claim("GroupID", curUser.UserGroupID.ToString()));
  
              var id = new ClaimsIdentity(claims, DefaultAuthenticationTypes.ApplicationCookie);
              var ctx = Request.GetOwinContext();
              AuthenticationManager.SignIn(id);
              return RedirectToAction("Index", "Home");
          }
      }
      else
      {
          ModelState.AddModelError("", "Invalid login attempt.");
      }
  
      return View(model);
  }
  </code></pre>
  
  <p>In my login partial I tried to get the value by doing this</p>
  
  <pre><code>public ActionResult _LoginPartial()
  {
      var identity = (ClaimsIdentity)User.Identity;
      TempData["curUserFullName"] = identity.FindFirst(ClaimTypes.Name).Value;
  
      string s= identity.FindFirst("GroupID").Value;
      return PartialView();
  }
  </code></pre>
  
  <p>I can get the username and full name with no problem but group id causes an object null error.</p>
  
  <p>Hoping someone could nudge me to the correct answer.</p>