Expand my Community achievements bar.

LDAP callback functionality

Avatar

Former Community Member

Masters,

I'm trying to implement LDAP callback functionality by  referring to this article under "CALLBACKS"

I've configured LDAP without issue. My requirement is assign ldap user to CRX group depending on attribute in DS server. Now As per my understanding, when LDAP user will attempt login first time then CQ will automatically call my class which implements Callback interface. Please correct me if I am wrong.

 So, I decided to create bundle which implements Callback interface. With my little knowledge I have done this so far -

i) In CRXDE lite, I added one bundle under geometrixx project and attached is the simple code but during building bundle I got error saying that Callback cannot be resolved to a type.

I could not find any documentation about this com.day.crx.security.ldap.sync.Callback interface. Kindly guide me. Appreciate your help

regards,

Elena 

1 Reply

Avatar

Former Community Member

I was able to proceed further by creating bundle and adding required dependency. However I'm stuck when I'm trying to type cast Value object as below -

@Override public void onUserSync(User userToBeSynched, Map<String, Value[]> attributes, ValueFactory valueFactory) throws RepositoryException { Iterator iter = attributes.entrySet().iterator(); while (iter.hasNext()) { Map.Entry mEntry = (Map.Entry) iter.next(); javax.jcr.Value val =  (javax.jcr.Value)mEntry.getValue();// Error** [Ljavax.jcr.Value; cannot be cast to javax.jcr.ValueSystem.out.println(mEntry.getKey() + " : " + val.getString()); } }

I do not understand why "L" is appended as Ljavax.jcr.Value which is coming from map. I want to get the values of Map but I'm stuck here. Kindly help!