title: UserPrincipal.EmployeeId not being stored after SignIn
body: <p>I'm using the ActiveDirectory authentication (from Microsoft.Owin) which is great for what I need, but I've encountered an issue where the EmployeeId is not being stored even though I set it during the SignIn process. I'm still trying to learn this library so I'm a little confused. Here is my code:</p>
  
  <p><em>AdAuthenticationService.cs</em></p>
  
  <pre><code>public class AdAuthenticationService
  {
      public class AuthenticationResult
      {
          public string ErrorMessage { get; private set; }
  
          public bool IsSuccess =&gt; string.IsNullOrEmpty(ErrorMessage);
  
          public AuthenticationResult(string errorMessage = null)
          {
              ErrorMessage = errorMessage;
          }
      }
  
      private readonly IAuthenticationManager authenticationManager;
  
      public AdAuthenticationService(IAuthenticationManager authenticationManager)
      {
          this.authenticationManager = authenticationManager;
      }
  
      public AuthenticationResult SignIn(String username, String password)
      {
          // authenticates against your domain account
          ContextType authenticationType = ContextType.Domain;
          PrincipalContext principalContext = new PrincipalContext(authenticationType);
          bool isAuthenticated = false;
          UserPrincipal userPrincipal = null;
          try
          {
              var eacId = DatabaseOperations.Login(username.Trim(), password.Trim());
              if (eacId &gt; 0)
              {
                  principalContext.ValidateCredentials(username.Trim(), password.Trim(), ContextOptions.Negotiate);
                  isAuthenticated = DatabaseOperations.Security(eacId) &gt; 0;
                  if (isAuthenticated)
                  {
                      userPrincipal = new UserPrincipal(principalContext,
                          DatabaseOperations.GetFullNameByEacId(eacId), password, true);
                      userPrincipal.EmployeeId = eacId.ToString();
                  }
              }
          }
          catch (Exception)
          {
              isAuthenticated = false;
              userPrincipal = null;
          }
  
          if (!isAuthenticated)
          {
              return new AuthenticationResult("Username or Password is not correct");
          }
  
          var identity = CreateIdentity(userPrincipal);
  
          authenticationManager.SignOut(ActiveDirectoryAuthentication.ApplicationCookie);
          authenticationManager.SignIn(new AuthenticationProperties() { IsPersistent = false }, identity);
  
  
          return new AuthenticationResult();
      }
  
      private ClaimsIdentity CreateIdentity(UserPrincipal userPrincipal)
      {
          var identity = new ClaimsIdentity(ActiveDirectoryAuthentication.ApplicationCookie, ClaimsIdentity.DefaultNameClaimType, ClaimsIdentity.DefaultRoleClaimType);
          identity.AddClaim(new Claim("http://schemas.microsoft.com/accesscontrolservice/2010/07/claims/identityprovider", "Active Directory"));
          identity.AddClaim(new Claim(ClaimTypes.Name, userPrincipal.SamAccountName));
          identity.AddClaim(new Claim(ClaimTypes.NameIdentifier, userPrincipal.SamAccountName));
  
          return identity;
      }
  }
  </code></pre>
  
  <p>In the SignIn method, you can I am setting the eacId under <code>userPrincipal.EmployeeId</code>, however when I try to access this from anywhere else in my project, it returns null.</p>
  
  <p>I'm assuming because of the CreateIdentity method, I should be adding a new claim to the identity object? But the object does not have anything for EmployeeId which is what I need.</p>