I'm using rust openid to authenticate against a Keycloak instance.
I would like to use client roles that should be represented in the access token.
The roles are mapped correctly, and the access token generated by Keycloak contains the roles.
So far I have been unable to extract those roles from the token.
Neither the default claims nor UserInfo can be used to extract such additional roles information or other custom claims.
A decrypted access token might look like this:
{
...
"resource_access": {
"some-client": {
"roles": [
"view",
"edit",
"delete"
]
},
"account": {
"roles": [
"manage-account",
"manage-account-links",
"view-profile"
]
}
},
"scope": "openid email profile",
"email_verified": true,
"custom-claim": [
"this",
"is",
"custom"
],
"name": "Test Tester",
...
}
Of course I could decrypt the RSA access token manually and extract the information, although I'm not 100% sure on how to do this, but I'm pretty sure there has to be an easier way than this, right?
Can anybody help me with this problem?