Skip to content
Advertisement

Access user info from SecurityIdentity using quarkus-oidc

I am using quarkus-oidc with keycloak and I have the following resource

JavaScript

My quarkus configurations is the following

JavaScript

I am calling the query as follow

JavaScript

The content of the jwt is

JavaScript

How can I access the user info stored in the token using quarkus oidc? I’ have seen that there is an option quarkus.oidc.authentication.user-info-required=true which will be calling the keycloak user-info endpoint to resolve the info from the token but it seems it is only working for opaque tokens which keycloak does not provide!

Advertisement

Answer

I’m not an expert on Quarkus, but following the guide for using OpenID it seems that you should inject the JsonWebToken jwt to be able to retrieve all the information related to a particular request authenticated via keycloak.

Later you can ask for any of the data included in the token. Probably you may need to ask for specific claims (in your case “family_name”, “given_name”, “email”, etc) using the previous jwt

User contributions licensed under: CC BY-SA
9 People found this is helpful
Advertisement