Group Attributes

1,700 views
Skip to first unread message

Pritha Srivastava

unread,
May 15, 2021, 1:03:13 AM5/15/21
to keyclo...@googlegroups.com
Hi All,

I have two Groups in Keycloak - Group1 and Group2. I have assigned an attribute to both Group1 and Group2. Group1's attribute is: Key:Value1 and Group2's attribute is Key:Value2, which means both the group's attribute has the same key but different values. I have a user User1 who belongs to Group1 and Group2, both. The client has a mapper for attribute 'Key'. Which group's attribute will show up in the access/id token for User1 and why? Is there a way to pass both the group's attributes in the access/id token?

Thanks,
Pritha

Karthik Narahari

unread,
May 16, 2021, 5:06:36 AM5/16/21
to Pritha Srivastava, keyclo...@googlegroups.com
Hi Pritha, Yes we can customize the mapper to add both attributes based on the users group membership by aggregating them and adding them as multi valued json array.
In Keycloak, all attributes added to a group are automatically inherited by users who have membership to these groups, so by this logic, you have to create a user attribute mapper with multivalued and aggregation toggles enabled (something like below)
image.png

-Karthik


--
You received this message because you are subscribed to the Google Groups "Keycloak User" group.
To unsubscribe from this group and stop receiving emails from it, send an email to keycloak-use...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/keycloak-user/CAPUxKPSgaB8ynGzOCcA5_YaYxOmVi25S1Ug4XH0Awyq1QfVfWA%40mail.gmail.com.
Reply all
Reply to author
Forward
0 new messages