title: IdentityServer4 Reject Token Request If Custom Parameter Not Valid
body: <p>I have this test client sending RequestToken:</p>
  
  <pre><code>var tokenResponse = await client.RequestTokenAsync(new TokenRequest
              {
                  Address = disco.TokenEndpoint,
                  GrantType = "password",
                  ClientId = "My_Client",
                  ClientSecret = "mysecret",
                  Parameters =
                  {
                      { "username", "user@entity.com" },
                      { "password", "userpassword" },
                      { "logged_entity_id", "143" },
                      { "scope", "MyAPI" }
                  }
              });
  </code></pre>
  
  <p>Now each user has a list of entity and I want to reject the token request if the value in the parameter "logged_entity_id" does not exist in the user's list of entity.</p>
  
  <p>I was initially planning on checking it via IsActiveSync in my CustomProfileService but I can't seem to access the raw parameters in IsActiveSync method.</p>
  
  <pre><code>    public class CustomProfileService : IProfileService
      {
          protected UserManager&lt;User&gt; _userManager;
  
          public CustomProfileService(UserManager&lt;User&gt; userManager)
          {
              _userManager = userManager;
          }
  
          public Task GetProfileDataAsync(ProfileDataRequestContext context)
          {
              var claims = new List&lt;Claim&gt;
              {
                  new Claim("LoggedEntityId", context.ValidatedRequest.Raw["logged_entity_id"])
              };
  
              context.IssuedClaims.AddRange(claims);
  
              return Task.FromResult(0);
          }
  
          public Task IsActiveAsync(IsActiveContext context)
          {
              var user = _userManager.GetUserAsync(context.Subject).Result;
              // var entityId = Can't access logged_entity_id parameter here
  
              context.IsActive = user != null &amp;&amp; user.DeletingDate == null &amp;&amp; user.entities.Contains(entityId);
              return Task.FromResult(0);
          }
      }
  </code></pre>
  
  <p>I'm not really sure if this is where I should check and reject it.</p>