# Role attribute to user attribute

**URL:** <https://forum.keycloak.org/t/role-attribute-to-user-attribute/2919>\
**Category:** Getting advice\
**Created:** [May 23, 2020, 9:43pm UTC](https://forum.keycloak.org/t/role-attribute-to-user-attribute/2919 "2020-05-23T21:43:06Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![sbernhard](https://avatars.discourse-cdn.com/v4/letter/s/ecae2f/32.png) [@sbernhard](https://forum.keycloak.org/u/sbernhard)\
**Post date:** [May 23, 2020, 9:43pm UTC](https://forum.keycloak.org/t/role-attribute-to-user-attribute/2919/1 "2020-05-23T21:43:06Z")

</div>

Hi,

Role R  
Role R has attribute A

User U has role R

I thought that this user U has now set attribute A. Isn’t this automatically the case? Or is this something missing for SAML, which I use in keycloak.

Thank you in advance.

---

<div class="post-metadata">

**Author:** ![amir](https://avatars.discourse-cdn.com/v4/letter/a/c37758/32.png) [@amir](https://forum.keycloak.org/u/amir)\
**Post date:** [April 18, 2023, 8:18am UTC](https://forum.keycloak.org/t/role-attribute-to-user-attribute/2919/2 "2023-04-18T08:18:42Z")

</div>

did you ever find a solution to this?

---

<div class="post-metadata">

**Author:** ![alihesari](https://yyz2.discourse-cdn.com/free1/user_avatar/forum.keycloak.org/alihesari/32/9842_2.png) [@alihesari](https://forum.keycloak.org/u/alihesari)\
**Post date:** [April 5, 2024, 6:08pm UTC](https://forum.keycloak.org/t/role-attribute-to-user-attribute/2919/3 "2024-04-05T18:08:37Z")

</div>

> [@sbernhard](#):
>
> Role R  
> Role R has attribute A
> 
> User U has role R
> 
> I thought that this user U has now set attribute A. Isn’t this automatically the case? Or is this something missing for SAML, which I use in keycloak.
> 
> Thank you in advance.

In Keycloak, when a user is assigned a role (such as Role R) that has an associated attribute (such as attribute A), the attribute is not automatically set for the user. This is because attributes associated with roles in Keycloak are not automatically propagated to users who are assigned those roles.

If you want the attribute A to be set for User U when they are assigned Role R, you would need to explicitly set the attribute for that user. This can be done manually through the Keycloak admin console or programmatically using the Keycloak Admin REST API.

---

<div class="post-metadata">

**Author:** ![jean.silga](https://avatars.discourse-cdn.com/v4/letter/j/f17d59/32.png) [@jean.silga](https://forum.keycloak.org/u/jean.silga)\
**Post date:** [April 6, 2024, 4:54am UTC](https://forum.keycloak.org/t/role-attribute-to-user-attribute/2919/4 "2024-04-06T04:54:13Z")

</div>

> [@amir](#):
>
> did you ever find a solution to this?

Can be achieved using group level attributes. I believe users inherit attributes of the groups they are part of.
