In our system we use Access Management solution from gravitee.io to manage authentication and configure JWT. This allows us to send custom user data via assertion
param of authentication request:
POST https://some-url.com/oauth/token
Content-Type: application/x-www-form-urlencoded; charset=UTF-8
grant_type=urn:ietf:params:oauth:grant-type:jwt-bearer&
client_id=id
client_secret=secret
assertion=lots-of-chars-here
On Access Management side I can configure rules for extraction and passing of mentioned custom user data. In our case we read some fields and convert them into custom claims of the access token we return as a response from https://some-url.com/oauth/token
.
Now I'm configuring the same logic for Azure. I have an application accepting assertion
of the authentication request similar to one mentioned above. I'm able to pass custom data, the next step is to read and pass them further.
How can I achieve this?
Note that: You cannot bypass custom claims delivered via assertion into claims returned of access token.
When I tried to generate token via OBO flow, I dint not get the assertion token claims bypassed in token:
GET https://login.microsoftonline.com/TenantID/oauth2/v2.0/token
grant_type=urn:ietf:params:oauth:grant-type:jwt-bearer
&client_id=ClientID
&client_secret=Secrets
&assertion=xxx
&scope=scope
&requested_token_use=on_behalf_of
Hence you need to create and assign custom claims to the application which is generating access token to get the custom claims Refer this SO Thread