[keycloak-user] Cannot create user in LDAP/AD from Keycloak using Full Name User Federation Mapper - CN is empty

Edgar Vonk - Info.nl Edgar at info.nl
Wed Jan 27 07:25:29 EST 2016


Hi,

I would like to use the Full Name User Federation Mapper to set the CN attribute in Active Directory from Keycloak. If I am not mistaken this is currently not possible in Keycloak because on creation of the user the only thing that is available is the username and no other user attributes (see UserFederationManager#addUser(RealmModel realm, String username).

Since the CN is mandatory it needs to be set during creation of the user object in AD (and in any LDAP server).  With our current configuration with the Full Name mapper enabled and configured to map to the CN attribute we cannot create users from Keycloak since the full name (as well as the first and last name) and hence the CN are still empty on user creation:


10:03:56,246 ERROR [org.keycloak.services.resources.ModelExceptionMapper] (default task-5) Error creating subcontext [cn= ,ou=Customers,dc=hf,dc=info,dc=nl]: org.keycloak.models.ModelException: Error creating subcontext [cn= ,ou=Customers,dc=hf,dc=info,dc=nl]


        at org.keycloak.federation.ldap.idm.store.ldap.LDAPOperationManager.createSubContext(LDAPOperationManager.java:425)


        at org.keycloak.federation.ldap.idm.store.ldap.LDAPIdentityStore.add(LDAPIdentityStore.java:75)


        at org.keycloak.federation.ldap.LDAPUtils.addUserToLDAP(LDAPUtils.java:50)


        at org.keycloak.federation.ldap.LDAPFederationProvider.register(LDAPFederationProvider.java:154)


        at org.keycloak.models.UserFederationManager.registerWithFederation(UserFederationManager.java:56)


        at org.keycloak.models.UserFederationManager.addUser(UserFederationManager.java:48)


        at org.keycloak.services.resources.admin.UsersResource.createUser(UsersResource.java:190)



If I am not mistaken the way Keycloak creates users is by first creating an ‘empty’ user with only the username set and after that the user is updated with all user attributes like firstname, last name, email etc.

The only workaround we can find is to add an attribute mapper that maps the Keycloak username field to the CN LDAP/AD attribute. This works ok but it different from how AD treats the CN which is as the full name and not the user name.

Shall I create a JIRA issue for this?

cheers
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.jboss.org/pipermail/keycloak-user/attachments/20160127/45e7b9d3/attachment.html 


More information about the keycloak-user mailing list