How I can get user IP inside JWT?
I have a task to extend JWT by custom fields. The most confusing field displays user IP inside the payload. I do it through admin REST inside OIDC. After get JWT I going inside a keycloak, catch user IP by session. Then insert it inside the session. But it looks like a bad decision.
Please advise me on how I can do it highly correctly. If I should change source code, every advice will be best.
How I catch IP:
url --location --request GET ‘http://0.0.0.0:8080/auth/admin/realms/master/users/64f225e2-2d1e-4a00-a2aa-d96bcc93f395/sessions’ --header ‘Authorization: bearer’ | | jq ‘..ipAddress’