How to properly inject custom claims from dynamic scopes into Keycloak JWT using a custom Protocol Mapper SPI? · keycloak keycloak · Discussion #40109 · GitHub
You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
8000
Repository navigation
How to properly inject custom claims from dynamic scopes into Keycloak JWT using a custom Protocol Mapper SPI?
#40109
I need to have a Springboot service — an orchestrator — perform login with an injection of information that will be embedded into the Keycloak JWT.
The login request will arrive at this orchestrator, which will query a database for some information and then pass it to another microservice to perform authentication with the enriched data.
Example:
The microservice-authenticate has an endpoint that receives:
reacted with thumbs up emoji reacted with thumbs down emoji reacted with laugh emoji reacted with hooray emoji reacted with confused emoji reacted with heart emoji reacted with rocket emoji reacted with eyes emoji
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
I need to have a Springboot service — an orchestrator — perform login with an injection of information that will be embedded into the Keycloak JWT.
The login request will arrive at this orchestrator, which will query a database for some information and then pass it to another microservice to perform authentication with the enriched data.
Example:
The
microservice-authenticatehas an endpoint that receives:{ "username": "estoquista", "password": "estoquista" }It forwards this to the
microservice-orchestrator, which queries the database and injects additional information for the next microservice:{ "username": "estoquista", "password": "estoquista", "empresaId": "2", "licenses": [ "stock", "pos" ] }The microservice-authorization will be responsible for authenticating against Keycloak and injecting this data into the JWT.
I tried the following approach:
I also created a SPI (Service Provider Interface) to organize this information but was not successful.
Maybe you didn't configure it correctly in keycloak.
All reactions