I'm testing the impersonation flow and I'm a bit confused regarding how it should work.
In the JWT the sub claim contains the ID of the impersonator and not the one being impersonated. I was kinda expecting this to be the latter, to avoid any special handling on the API side.
Let's say I want the user ID of the impersonated user in the impersonatedUser claim. Is the recommended way of handling this in the API to 1st check for the impersonatedUser claim (someone is being impersonated) and then use sid (no impersonation) if the former isn't present? What is the recommended way of doing this?
Example JWT created by the policy:
[Header].{
"exp": 1662552679,
"nbf": 1662549079,
"ver": "1.0",
"iss": "https://foo.b2clogin.com/39b9ad06-299d-43da-a960-5e07d3ca9c06/v2.0/",
"sub": "0eebe778-5934-48f6-84a6-bf921f467877", <-- This is the ID of the impersonator
"aud": "64cb0c7e-678d-477c-8efc-a011c3614e58",
"acr": "b2c_1a_impersonation",
"nonce": "defaultNonce",
"iat": 1662549079,
"auth_time": 1662549079,
"name": "unknown",
"impersonatedUser": "a@customer.com"
}.[Signature]