hello,
Is there any OOTB functionality available to synchronize users from LDAP into CQ5?
If not, please help me to proceed in below scenario.
I have written a scheduler, which will pull the user details from LDAP and create the user into CQ using UserManager. This process is not creating the user same as system creates when user logs in. I am finding difficulty in setting attribute rep:principalName and process is throwing below given exception.
com.wem.ldap.ScheduledPeriodicJob RepositoryException while getting session javax.jcr.nodetype.ConstraintViolationException: Attempt to modify protected property rep:principalName of User 'xxxx'
at org.apache.jackrabbit.core.security.user.AuthorizableImpl.checkProtec tedProperty(AuthorizableImpl.java:447)
at org.apache.jackrabbit.core.security.user.AuthorizableImpl.setProperty (AuthorizableImpl.java:174)
at org.apache.jackrabbit.core.security.user.UserImpl.setProperty(UserImp l.java:38)
at com.wem.ldap.ScheduledPeriodicJob.run(ScheduledPeriodicJob.java:136)
at org.apache.sling.commons.scheduler.impl.QuartzJobExecutor.execute(Qua rtzJobExecutor.java:56)
at org.quartz.core.JobRunShell.run(JobRunShell.java:213)
at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExec utor.java:886)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor .java:908)
at java.lang.Thread.run(Thread.java:662)
here is the code I have written
resourceResolver = resourceResolverFactory.getAdministrativeResourceResolver(null);
session = resourceResolver.adaptTo(Session.class);
JackrabbitSession jackrabbitSession = (JackrabbitSession) session;
UserManager manager = jackrabbitSession.getUserManager();
user = manager.createUser("xxxx", "xxxxx");
value = valueFactory.createValue("xxxx");
user.setProperty("cq:first-name", value);
value = valueFactory.createValue("xxxx");
user.setProperty("cq:last-name", value);
value = valueFactory.createValue("xxx@xxxx.com");
user.setProperty("rep:e-mail", value);
value = valueFactory.createValue("CN=xxxx,OU=Users,DC=company,DC=com");
user.setProperty("rep:principalName", value);
jackrabbitSession.save();
can you please provide the code block to create user, which needs to get authenticated against ldap password.
Thanks,
Sastry
Hi Sastry,
For earlier cq5 you can use [1]. For cq5.5 please install the latest update1 and then you can sync using jmx by following[2].
[2]
* Go to /system/console/jmx and login as admin
* Search for com.adobe.granite.ldap and click on it
* You will see two methods. syncuser & syncuserlist. Supply the necessary parameter as in 5.4.
Thanks,
Sham
Sorry for delayed response. Schedule the curl to trigger using a cronjob on a scheduled basis. Just now I published an article to get the mbean take a look at [1].
[1] http://dev.day.com/content/kb/home/Crx/CrxFAQ/how-to-synchronize-user- with-ldap.html
North America
Europe, Middle East and Africa
Asia Pacific