title: ASP.NET MVC Windows Authenticate with extending properties
body: <p>I need help of experts!</p>
  
  <hr>
  
  <p>I write ASP.NET MVC 4 Intranet application. I using Windows Authentication, the domain name get through <code>User.Identity.Name.</code> I have a database with the configured data context, where more complete information about the user: Last name, First name, E-mail, etc. As well as a list of user access groups.</p>
  
  <p>Needed to make sure that a user open a program, has received the required access from the database, his name brought up in the upper right corner of the page.</p>
  
  <p>Now I have realized that with the use of OWIN Asp.Net Identity. I created a base controller that inherits the other controllers, it ordered <em>CurrentUser</em> method for the user and his SignIn:</p>
  
  <pre><code>protected ApplicationUser CurrentUser
  {
      get
      {
          var curUser = AppUserManager.FindByName(User.Identity.Name);
          if (curUser != null)
              SignInManager.SignIn(curUser, true, true);
          else
              curUser = new ApplicationUser();
  
          return curUser;
      }
  }
  
  protected ApplicationSignInManager SignInManager
  {
      get
      {
          return HttpContext.GetOwinContext().Get&lt;ApplicationSignInManager&gt;();
      }
  }
  </code></pre>
  
  <p>I understand that these operations are unnecessary, when you refresh the page every time it is necessary to drag into the database, users receive and make SignIn, which is unnecessary. </p>
  
  <p>I'm sure you can realize all without using Asp.Net Identity. For example by expanding <code>IPrincipal User</code>, adding him to the field name, which are needed when displaying pages and adding once Roles from the database and save all in Cookies.</p>
  
  <p>Please, help me! And sorry for my bad english...</p>