title: Setting a custom principal for the ASP.NET Identity Provider
body: <p>I am using the Microsoft.ASPNET.Identity provider and I want to set a custom principal.</p>
  
  <p>Previously with FomrsAuthentication, I would have done something like this:</p>
  
  <pre><code>    protected void Application_AuthenticateRequest(Object sender, EventArgs e)
      {
          HttpCookie authCookie = Request.Cookies[FormsAuthentication.FormsCookieName];
  
          if(authCookie != null)
          {
              using (var db = new GSCM.Logic.GSCMDatabase())
              {
                  FormsAuthenticationTicket ticket = FormsAuthentication.Decrypt(authCookie.Value);
                  var id = new GenericIdentity(ticket.Name);
                  var principal = new VmUserLogin(id);
                  var found = db.LoadInternalUser(ticket.Name);
                  if(found != null)
                  {
                      Mapper.Map(found, principal);
                  }
  
                  HttpContext.Current.User = principal;
              }
          }
      }
  </code></pre>
  
  <p>How can I do something similar with the ientity provider</p>