• Welcome to KonaKart Community Forum. Please login or sign up.
 

Open LDAP Integration

Started by lionCoolKing, July 18, 2011, 10:46:06 am

Previous topic - Next topic

lionCoolKing

Hi All,

Can anyone please give some hint how to integrate Open LDAP with konakart.

Regards

lionCoolKing

some hint would be enough for me........ :-\

julie

If you want to use LDAP just for authentication then you need to use the LoginIntegrationMgr http://www.konakart.com/docs/CustomCredentialChecking.html

lionCoolKing

Thanks,

As you said I did the same i created a class called LDAPConn. Below is the code.


package com.konakart.bl;

import java.util.Hashtable;

import javax.naming.Context;
import javax.naming.directory.DirContext;
import javax.naming.directory.InitialDirContext;

import com.konakart.app.KKException;



public class LDAPConn implements  com.konakart.bl.LoginIntegrationMgrInterface{

   @Override
   public int checkCredentials(String username, String password) throws KKException {
      System.out.println("inside the checkCredentials()!!!!!!!!!!!!!!!!!!!!!");
      int loginCheck = 0;
      Hashtable<String, String> env = new Hashtable<String, String>(11);
      env.put(Context.INITIAL_CONTEXT_FACTORY, "com.sun.jndi.ldap.LdapCtxFactory");
      env.put(Context.PROVIDER_URL, "ldap://localhost:389");
      env.put(Context.SECURITY_AUTHENTICATION, "simple");
      env.put(Context.SECURITY_PRINCIPAL,"cn=Manager,dc=tcubes,dc=com");
      env.put(Context.SECURITY_CREDENTIALS,"manager");
      try{
         DirContext ctx = new InitialDirContext(env);
         loginCheck = 1;
         ctx.close();
      }catch (Exception e) {
         loginCheck = -1;
      }
      return loginCheck;
   }
   
}

I have also changed the name of the Login Integration Class to com.konakart.bl.LDAPConn. I just wanted to see the System.out.println("inside the checkCredentials()!!!!!!!!!!!!!!!!!!!!!");. But its not printing in the console. Its not giving any exception as well. Please help.

Regards

lionCoolKing

please help me get out this......... :(