# Is there a way to convert saml assertion to token claims without storing them as role/group or user attribute

**URL:** <https://forum.keycloak.org/t/is-there-a-way-to-convert-saml-assertion-to-token-claims-without-storing-them-as-role-group-or-user-attribute/19866>\
**Category:** Getting advice\
**Tags:** authentication, identity-brokering, user-federation, saml\
**Created:** [January 25, 2023, 4:34pm UTC](https://forum.keycloak.org/t/is-there-a-way-to-convert-saml-assertion-to-token-claims-without-storing-them-as-role-group-or-user-attribute/19866 "2023-01-25T16:34:16Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![kkcmadhu](https://yyz2.discourse-cdn.com/free1/user_avatar/forum.keycloak.org/kkcmadhu/32/7545_2.png) [@kkcmadhu](https://forum.keycloak.org/u/kkcmadhu)\
**Post date:** [January 25, 2023, 4:34pm UTC](https://forum.keycloak.org/t/is-there-a-way-to-convert-saml-assertion-to-token-claims-without-storing-them-as-role-group-or-user-attribute/19866/1 "2023-01-25T16:34:16Z")

</div>

I have an saml2.0 identity provider, I have some assertions coming in , I want to map those assertions into custom claims in my keycloak jwt token,  
how can i achieve this.  
I dont want to really store the incoming assertion into a role/group or user attribute…  
I just want to get those attributes from saml assertion, not store anywhere in keycloak, and mint the info in token.

Is this possible?

---

<div class="post-metadata">

**Author:** ![kkcmadhu](https://yyz2.discourse-cdn.com/free1/user_avatar/forum.keycloak.org/kkcmadhu/32/7545_2.png) [@kkcmadhu](https://forum.keycloak.org/u/kkcmadhu)\
**Post date:** [January 25, 2023, 4:42pm UTC](https://forum.keycloak.org/t/is-there-a-way-to-convert-saml-assertion-to-token-claims-without-storing-them-as-role-group-or-user-attribute/19866/2 "2023-01-25T16:42:12Z")

</div>

There is something called userSession mapper in saml/oidc identity provider mapper, and user session note mapper in client scopes… i am thinking of exploring that combination to check if it will work.

but , the time out (user session timeout), etc could be challenging… not sure if it will work.

has any one tried such a thing??
