I'm working on securing a legacy monolith webapp with Keycloak (I'm pretty new to Keycloak) and am trying to figure out how best to retrieve the JWT token so I can extract some attributes from it. I've been playing around with it for a couple of days now, and the authentication portion works fine, but once authenticated, I need to extract some application specific attributes from the JWT token so I can handle authorization in the target app. I have not been able to figure out how to easily do that.
Any help would be greatly appreciated as I'm sure I'm just missing something super obvious.
EDIT: I'm using the keycloak-servlet-filter-adapter to handle the authentication with Keycloak.
EDIT2: I've been playing around some with the AuthzClient
and from there I can get the access token. Is there something I can do to retrieve the "user attributes" for the user that has this access token? In Keycloak I have some custom user attributes that are being fetched from an external user store, and I need to be able to programmatically retrieve those after logging the user in.