title: Keycloak registration - custom user attribute value not picked up correctly
body: <p>I am evaluating KeyCloak, and am trying to configure it as a SAML IDP to a SalesForce client. The SAML flow works fine, however I am running into an issue with new user registration. KeyCloak is backed by a User Federation LDAP (AD LDS).
  I have a custom field mapped to the cn field in the LDAP, and have updated the register.ftl in my custom theme. I have also added a mapper, which maps this custom field to the LDAP attribute.</p>
  <p>I get an error when I try to register the user, and it looks like the value of the custom attribute is not being picked up correctly.
  I cannot find anything useful when I search online, which makes me think that there is probably a silly mistake somewhere that I haven't spotted.</p>
  <p><strong>Mapping</strong>:</p>
  <ul>
  <li>Name: MRN</li>
  <li>Mapper Type: user-attribute-ldap-mapper</li>
  <li>User Model Attribute: mrn</li>
  <li>LDAP Attribute: cn</li>
  <li>Read Only: OFF</li>
  <li>Is Mandatory In LDAP: ON</li>
  <li>Is Binary Attribute : OFF</li>
  </ul>
  <p><strong>Federation provider settings:</strong></p>
  <ul>
  <li>Username LDAP attribute :userPrincipalName</li>
  <li>RDN LDAP attribute :cn</li>
  <li>UUID LDAP attribute :mail</li>
  </ul>
  <p><strong>Template</strong>:</p>
  <pre><code> &lt;div class=&quot;${properties.kcFormGroupClass!} ${messagesPerField.printIfExists('mrn',properties.kcFormGroupErrorClass!)}&quot;&gt;
      &lt;div class=&quot;${properties.kcLabelWrapperClass!}&quot;&gt;
          &lt;label for=&quot;mrn&quot; class=&quot;${properties.kcLabelClass!}&quot;&gt;MRN&lt;/label&gt;
      &lt;/div&gt;
      &lt;div class=&quot;${properties.kcInputWrapperClass!}&quot;&gt;
          &lt;input type=&quot;text&quot; id=&quot;user.attributes.mrn&quot; class=&quot;${properties.kcInputClass!}&quot; name=&quot;user.attributes.mrn&quot; value=&quot;${(register.formData['user.attributes.mrn']!'')}&quot; /&gt;
      &lt;/div&gt;
  &lt;/div&gt;           
  </code></pre>
  <p>This is the error I get when I try to register a new user (I entered 123456 into the MRN field) :</p>
  <pre><code>14:08:43,514 WARN  [org.keycloak.services] (default task-1) KC-SERVICES0013: Failed authentication: org.keycloak.models.ModelException: Could not retrieve identifier for entry [cn=\ ,OU=Emp,DC=MyPortal,DC=TEST,DC=COM].
          at org.keycloak.storage.ldap.idm.store.ldap.LDAPIdentityStore.getEntryIdentifier(LDAPIdentityStore.java:546)
          at org.keycloak.storage.ldap.idm.store.ldap.LDAPIdentityStore.add(LDAPIdentityStore.java:99)
          at org.keycloak.storage.ldap.LDAPUtils.addUserToLDAP(LDAPUtils.java:78)
  
  </code></pre>