title: Why is User.Identity null after login with AspNet.Identity 3.0
body: <p>I am using Microsofts AspNet.Identity 3.0 framework within the DNX RC1. With the help of some tutorials I have built a custom authentication system. After a successful password check some claims are created for the user and the Authentication will be set:</p>
  
  <pre><code>var claimsPrincipal = await SignInManager.CreateUserPrincipalAsync(user);
  if (claimsPrincipal != null &amp;&amp; claimsPrincipal.Identity != null)
  {
      // Set the claims to the user 
      await HttpContext.Authentication.SignInAsync(CookieAuthenticationDefaults.AuthenticationScheme, claimsPrincipal);
      return RedirectToAction("Index", "App");
  }
  </code></pre>
  
  <p>After this login action my browser has two cookies: <em>.AspNet.Cookies</em> and <em>.AspNet.Microsoft.AspNet.Identity.Application</em></p>
  
  <p>However I do have now a problem with my identity. Controllers annotated with [Authorize] are not executed at all. And controllers with [AllowAnonymous] give me a NullReferenceException because User.Identity is null:</p>
  
  <pre><code>[AllowAnonymous]
  [Route("api/trips")]
  public class TripController : Controller
  {
  
  [HttpGet("")]
  public JsonResult Get()
  {
      var trips = _repository.GetUserTripsWithStops(User.Identity.Name);
      ...
  
      return Json(results);
  }
  </code></pre>
  
  <p>Can someone please tell me what's wrong with my authentication?</p>
  
  <p>As I guess that my mistake is somewhere in the Startup.cs file - here is the configure method:  </p>
  
  <pre><code>public void Configure(IApplicationBuilder app)
  {
      app.UseStaticFiles();
  
      app.UseIdentity();
      app.UseCookieAuthentication(options =&gt;
      {
          options.LoginPath = new PathString("/App/Login");
      });
  
      app.UseMvc(routes =&gt;
      {
          routes.MapRoute(
              name: "default",
              template: "{controller}/{action}/{id?}",
              defaults: new { controller = "App", action = "Index" });
      });
  }
  </code></pre>