# How to add 'memberOf' attribute to SAML response

**URL:** <https://forum.keycloak.org/t/how-to-add-memberof-attribute-to-saml-response/25381>\
**Category:** Miscellanaeous\
**Created:** [April 3, 2024, 2:29pm UTC](https://forum.keycloak.org/t/how-to-add-memberof-attribute-to-saml-response/25381 "2024-04-03T14:29:20Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![psn](https://avatars.discourse-cdn.com/v4/letter/p/9d8465/32.png) [@psn](https://forum.keycloak.org/u/psn)\
**Post date:** [April 3, 2024, 2:29pm UTC](https://forum.keycloak.org/t/how-to-add-memberof-attribute-to-saml-response/25381/1 "2024-04-03T14:29:20Z")

</div>

Hello community members,

Is there any way we can add the ‘memberOf’ attribute to the SAML response? Users are federated from LDAP server (read-only) mode to the Keycloak server.

Any help on this is much appreciated.

Thank you.

---

<div class="post-metadata">

**Author:** ![iilr](https://avatars.discourse-cdn.com/v4/letter/i/bcef8e/32.png) [@iilr](https://forum.keycloak.org/u/iilr)\
**Post date:** [March 12, 2025, 2:29pm UTC](https://forum.keycloak.org/t/how-to-add-memberof-attribute-to-saml-response/25381/2 "2025-03-12T14:29:29Z")

</div>

Hello! Did u find a solution for this? I have the same question

---

<div class="post-metadata">

**Author:** ![dteleguin](https://yyz2.discourse-cdn.com/free1/user_avatar/forum.keycloak.org/dteleguin/32/11917_2.png) [@dteleguin](https://forum.keycloak.org/u/dteleguin)\
**Post date:** [April 16, 2025, 8:40pm UTC](https://forum.keycloak.org/t/how-to-add-memberof-attribute-to-saml-response/25381/3 "2025-04-16T20:40:33Z")

</div>

This requires two steps:

1. Go to LDAP Settings → Mappers tab, create a mapper of type `user-attribute-ldap-mapper`, map the `memberOf` LDAP attribute to a User Model Attribute of your choice;
2. Go to your SAML client configuration, add a mapper (by configuration) of type `User Attribute`, then map the user attribute to SAML attribute.

Depending on you Keycloak version, you might need to define the custom attribute in Realm settings → User Profile.
