I'm trying to use OIDC/OAuth to authenticate the user against Microsoft Azure and have the roles claim from the ID token assigned to the authenticated user.
I managed to get the authentication portion working, the user is redirected to Azure, after logging in it's authenticated but I can't figure out how to map the roles.
In the logs I see:
02:04:13,301 DEBUG [io.undertow.request.security] (default task-1) Authenticated as user1, roles []I used the elytron-oidc-client, here is my configuration.
standalone.xml snippet:
<subsystem xmlns="urn:wildfly:elytron-oidc-client:2.0">
<secure-deployment name="simple-webapp-rest.war">
<provider-url>https://login.microsoftonline.com/tennant-id/v2.0</provider-url>
<ssl-required>NONE</ssl-required>
<use-resource-role-mappings>true</use-resource-role-mappings>
<principal-attribute>sub</principal-attribute>
<client-id>client-id</client-id>
<credential name="secret" secret="secret"/>
</secure-deployment>
</subsystem>
JWT snippet:
{
"iat": 1744145825,
"nbf": 1744145825,
"exp": 1744149725,
...
"roles": [
"3d45e2c8-4693-4b9f-8669-e9b0deafc1b2",
"f8700e8f-0179-49c9-b651-6a498840ca32",
"7f68cea5-fefc-46bf-a32b-61bf6ab5eb44"
],
...
"ver": "2.0"
}
I would like the roles to be assigned to the user.
Furthermore, the ID token gives the ID of the roles, i would like to be also able to map the id to the actual role name.
From varios posts it seems that this is possible but i have not seen an example.
Can you please help me figure out how to configure this?
Any help would be appreciated.
Thanks,
Ion