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:
<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:
"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