title: How add custom claim to Azure AD access token (JWT) at token request time?
body: <p>The current JWT from Azure AD has the following structure:</p>
  
  <p>AzureAD JWT:</p>
  
  <pre><code>{
    "aud": "a5aa555a-aa55-5aaa-5a55-555a5aa55a5a",
    "iss": "https://sts.windows.net/a5aa555a-aa55-5aaa-5a55-555a5aa55a5a/",
    "iat": 1547084136,
    "nbf": 1547084136,
    "exp": 1547089036,
    "acr": "1",
    "aio": "aaaaaaaaaaaaa==",
    "appid": "a5aa555a-aa55-5aaa-5a55-555a5aa55a5a",
    "appidacr": "1",
    "email": "bob@bob.com",
    "idp": "https://sts.windows.net/a5aa555a-aa55-5aaa-5a55-555a5aa55a5a/",
    "ipaddr": "192.168.1.1",
    "name": "Bob Bob",
    "oid": "a5aa555a-aa55-5aaa-5a55-555a5aa55a5a",
    "roles": [],
    "scp": "Directory.AccessAsUser.All User.Read",
    "sub": "a5aa555a-aa55-5aaa-5a55-555a5aa55a5a",
    "tid": "a5aa555a-aa55-5aaa-5a55-555a5aa55a5a",
    "unique_name": "bob@bob.com",
    "uti": "kjkugiugi",
    "ver": "1.0"
  }
  </code></pre>
  
  <p>I want to add in an extra few claims such as <code>departmentId</code>, <code>someOtherCustomInfo</code>. I want to do this in my token request, not have this preset. How would I do that?</p>
  
  <p>Currently, I use ADAL4J to get the token:</p>
  
  <pre><code>//Represents the authority we are asking to provide tokens
  AuthenticationContext context = new AuthenticationContext(
      authority,
      true,
      Executors.newFixedThreadPool( numInPool )
  );
  
  Future&lt;AuthenticationResult&gt; future = context
      .acquireTokenByAuthorizationCode(
          authCode,
          new URI( redirectUri ),
          credentials,
          resource,
          null
      );
  
  AuthenticationResult authResult = future.get();
  
  //The token
  String token = authResult.getAccessToken();
  </code></pre>