Expand my Community achievements bar.

Don’t miss the AEM Skill Exchange in SF on Nov 14—hear from industry leaders, learn best practices, and enhance your AEM strategy with practical tips.
SOLVED

LDAP callback error

Avatar

Level 3

Hello,

I have set up the LDAP and in ldap_login.conf I set up syncCallbackClass="com.test.ldap.LDAPConnector". I then created the bundle that contains the class LDAPConnector that extends the Callback. 

However, after deploying the bundle I am seeing following error. Looks like it is not finding the class in the bundle.

27.02.2014 17:16:34.633 *ERROR* [127.0.0.1 [1393521394629] PUT /libs/sling/topology/connector.521e314c-30be-4efc-b9df-24f03f3d6af6.json HTTP/1.1] com.day.crx.security.ldap.LDAPUserSync Unable to initialize synchronization callback java.lang.ClassNotFoundException: com.test.ldap.LDAPConnector not found by com.day.crx.sling.server [65]

Any pointer would be greatly appreciated. 

1 Accepted Solution

Avatar

Correct answer by
Employee

LDAP Callbacks are not DS components, so you can't use @Reference.

If you need access to the JCR Session from an LDAP Callback, you need to implement the interface com.day.crx.security.ldap.sync.ExtendedCallback. It unfortunately does not appear that this interface is listed in the public JavaDoc.

View solution in original post

9 Replies

Avatar

Level 10

In your bundle have you exported package?

Avatar

Level 3

Ah found the issue. I had to refresh "Day CRX LDAP Authenticationcom.day.crx.crx-auth-ldap" bundle.

Avatar

Level 3

I have a follow up question.

Looks like I do not have access to the session from the LDAP callback. How do I get the user stored in crx to update its property in callback method? Do I need to connect to Repo programmatically? 

Avatar

Level 10

   @Reference
    private Repository repository;

Avatar

Level 3

I get java.lang.NullPointerException

@Reference
private SlingRepository repository;
private Session session;

.....

try {
          LOGGER.debug("trying to get session..");
          repository.login();
        
  session = repository.loginAdministrative(null);
         
 LOGGER.debug("session " + session);

    
   } finally {   
                         session.logout(); 
                   }

 

Thanks

Avatar

Correct answer by
Employee

LDAP Callbacks are not DS components, so you can't use @Reference.

If you need access to the JCR Session from an LDAP Callback, you need to implement the interface com.day.crx.security.ldap.sync.ExtendedCallback. It unfortunately does not appear that this interface is listed in the public JavaDoc.

Avatar

Level 3

Justin - thank you for the prompt response.

I do not see ExtendedCallback class in "com.day.crx.security.ldap.sync" package. Is it available publicly?

Here is my dependency:    

            <dependency>
                <groupId>com.day.crx</groupId>
                <artifactId>crx-auth-ldap</artifactId>
                <version>2.3.5</version>
                <scope>provided</scope>
            </dependency>