title: AuthenticateResult: Why are some claims missing?
body: <p>I'm trying out a self-hosted IdentityServer3 solution and have come across an issue that I haven't found an answer to.</p>
  
  <p>This is my IdentityServer setup:</p>
  
  <pre><code>var factory = new IdentityServerServiceFactory();
  factory.UseInMemoryClients(Config.GetClients())
         .UseInMemoryScopes(Config.GetScopes());
  factory.UserService = new Registration&lt;IUserService&gt;(resolver =&gt; new LocalRegistrationUserService());
  var options = new IdentityServerOptions
  {
      SiteName = "Demo IdP",
      SigningCertificate = Certificate.Get(),
      Factory = factory,
      RequireSsl = Convert.ToBoolean(ConfigurationManager.AppSettings["RequireSsl"]),
  };
  app.UseIdentityServer(options);
  </code></pre>
  
  <p>Scope(s) and client(s):</p>
  
  <pre><code>public static IEnumerable&lt;Client&gt; GetClients() 
  {
      return new List&lt;Client&gt;
          {
              new Client
                  {
                      ClientId = "resourceowner.client",
                      ClientSecrets =
                          {
                              new Secret("3FE8FB45-627A-4C44-BBE3-63281C6CA910".Sha256())
                          },
                      AllowedScopes = { "demo", "openid", "profile" },
                      Flow = Flows.ResourceOwner,
                  }   
          };
  }
  
  public static IEnumerable&lt;Scope&gt; GetScopes()
  {
      return new List&lt;Scope&gt;
          {
              new Scope
                  {
                      Name = "demo",
                      DisplayName = "Demo",
                  },
              StandardScopes.OpenId,
              StandardScopes.Profile,
          };
  } 
  </code></pre>
  
  <p>And in <code>LocalRegistrationUserService.AuthenticateLocalAsync(LocalAuthenticationContext context)</code> I've got:</p>
  
  <pre><code>var loginResult = new AccountManagementService().Login(context.UserName, context.Password);
  if (loginResult.LoginOk)
  {
      context.AuthenticateResult = new AuthenticateResult(loginResult.Subject, loginResult.UserName);
  }
  else
  {
      ....
  }
  </code></pre>
  
  <p>My understanding of the following paragraph from the documentation</p>
  
  <p>
  *To fully log the user in the authentication API must produce a subject and a name that represent the user. The subject is the user service’s unique identifier for the user and the name is a display name for the user that will be displayed in the user interface.*</p>
  
  <p>is that the subject and username will be present in the token returned by IdentityServer. However, when I decode the token this is what I get:</p>
  
  <pre><code>Access Token (decoded):
  {
    "typ": "JWT",
    "alg": "RS256",
    "x5t": "a3rMUgMFv9tPclLa6yF3zAkfquE",
    "kid": "a3rMUgMFv9tPclLa6yF3zAkfquE"
  }
  {
    "iss": "http://localhost:44333/core",
    "aud": "http://localhost:44333/core/resources",
    "exp": 1478524845,
    "nbf": 1478521245,
    "client_id": "resourceowner.client",
    "scope": [
      "demo",
      "openid",
      "profile"
    ],
    "sub": "6ace8b2e-ce20-41e9-8d4e-382168e4ce05",
    "auth_time": 1478521245,
    "idp": "idsrv",
    "amr": [
      "password"
    ]
  }
  </code></pre>
  
  <p>As is evident, no name claim is present. I've tried adding the claim explicitly when instantiating AuthenticateResult, but to no avail. I'm clearly missing something here, but can't for the best of it figure out what I'm doing wrong so tips, pointers and/or a helpful example would be much appreciated.</p>
  
  <p>TIA</p>