ptrkv
ptrkv

Reputation: 21

How to map azure object_id in oidc identity provider in keycloak?

As in the title, anybody knows how to get the object id of the user in oidc identity provider using keycloak?

I cannot figure out a way to add a custom mapper to get the user object id (as on the screenshot) when authenticating againt Azure Active Directory - when the Token (KeycloakAuthenticationToken) is populated to the Rest API, it does contain principal property from keycloak, not azure active directory.

Azure identifier:

Azure identifier

I have sucessfully created a mapper for the groups - using this answer: https://stackoverflow.com/a/64411029/14320246

However there are available as additional attributes, as on screenshot Additonal attributes, but it is acceptable behaviour for also the oid param.

Upvotes: 2

Views: 1747

Answers (1)

mkosterin
mkosterin

Reputation: 21

You should use 'oid' claim in your mapper. But you have to change default scope at Identity provider -> provider name -> Settings -> Default Scopes to "openid profile"

Upvotes: 2

Related Questions