# XML representation of "User Attribute" in SAML client import for Keycloak

**URL:** <https://forum.keycloak.org/t/xml-representation-of-user-attribute-in-saml-client-import-for-keycloak/22788>\
**Category:** Getting advice\
**Tags:** saml\
**Created:** [June 20, 2023, 6:21pm UTC](https://forum.keycloak.org/t/xml-representation-of-user-attribute-in-saml-client-import-for-keycloak/22788 "2023-06-20T18:21:44Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![Phoenix](https://yyz2.discourse-cdn.com/free1/user_avatar/forum.keycloak.org/phoenix/32/8814_2.png) [@Phoenix](https://forum.keycloak.org/u/Phoenix)\
**Post date:** [June 20, 2023, 6:21pm UTC](https://forum.keycloak.org/t/xml-representation-of-user-attribute-in-saml-client-import-for-keycloak/22788/1 "2023-06-20T18:21:44Z")

</div>

I am attempting to import an SAML client into Keycloak using an XML file that includes certain mappers. The XML file contains the following mappers:

```auto
<md:AttributeConsumingService index="0">
  <md:ServiceName xml:lang="fr">test 1</md:ServiceName>
  <md:ServiceDescription xml:lang="fr">test 1</md:ServiceDescription>
  <md:RequestedAttribute NameFormat="urn:oasis:names:tc:SAML:2.0:attrname-format:uri" Name="urn:oid:0.9.2342.19200300.100.1.3" FriendlyName="mail" isRequired="true"/>
  <md:RequestedAttribute NameFormat="urn:oasis:names:tc:SAML:2.0:attrname-format:uri" Name="urn:oid:2.5.4.42" FriendlyName="givenName" isRequired="true"/>
</md:AttributeConsumingService>

```

However, when importing these mappers into Keycloak, the “User Attribute” value for each mapper is empty.

Alternatively, when using a JSON file and adding the “user.attribute” option, the “User Attribute” value is correctly populated. Here is an example of the JSON representation:

```auto
"protocolMappers": [
  {
    "name": "urn:oid:0.9.2342.19200300.100.1.3",
    "protocol": "saml",
    "protocolMapper": "saml-user-attribute-mapper",
    "consentRequired": false,
    "config": {
      "attribute.nameformat": "URI Reference",
      "friendly.name": "mail",
      "attribute.name": "urn:oid:0.9.2342.19200300.100.1.3",
      "user.attribute": "mail"
    }
  },
  {
    "name": "urn:oid:2.5.4.42",
    "protocol": "saml",
    "protocolMapper": "saml-user-attribute-mapper",
    "consentRequired": false,
    "config": {
      "attribute.nameformat": "URI Reference",
      "friendly.name": "givenName",
      "attribute.name": "urn:oid:2.5.4.42",
      "user.attribute": "givenName"
    }
  }
]

```

In the JSON representation, the “User Attribute” field takes the value of “user.attribute” in Keycloak.

My question is: How can I represent the “User Attribute” in XML so that Keycloak can process it correctly and populate the value?

Thanks in advance
