Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Keycloak: get identity provider info

I have spring boot app and I use keycloak as auth. provider.

For my realm I have set FACEBOOK or GOOGLE as identity providers.

I wonder how can I find out what identity provider user used - NOT via keycloak admin console, BUT in runtime.


eg.:

user A - FACEBOOK

user B - FACEBOOK

user C - GOOGLE

like image 983
Tomas Marik Avatar asked Jan 18 '26 15:01

Tomas Marik


2 Answers

You can set a "User Session Note" mapper to your client's mappers. Set the User Session Note field to: identity_provider

Session Note Mapper

Note: you can use identity_provider_identity in User Session Note field to get its username from to identity provider https://www.keycloak.org/docs/latest/server_admin/index.html#available-user-session-data

like image 70
Thierry D. Avatar answered Jan 20 '26 22:01

Thierry D.


Map metadata given in the access token, such as facebook/google user id, and import these to the keycloak user. If you then provide this metadata to the clients, they can see which identity broker that was used.

https://keycloak.gitbooks.io/server-adminstration-guide/content/topics/identity-broker/mappers.html

like image 35
rckrd Avatar answered Jan 20 '26 20:01

rckrd