KonaKart Community Forum

Installation / Configuration => Programming of KonaKart => Topic started by: lionCoolKing on July 18, 2011, 10:46:06 am

Title: Open LDAP Integration
Post by: lionCoolKing on July 18, 2011, 10:46:06 am
Hi All,

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

Regards
Title: Re: Open LDAP Integration
Post by: lionCoolKing on July 19, 2011, 10:57:24 am
some hint would be enough for me........ :-\
Title: Re: Open LDAP Integration
Post by: julie on July 19, 2011, 10:58:25 pm
If you want to use LDAP just for authentication then you need to use the LoginIntegrationMgr http://www.konakart.com/docs/CustomCredentialChecking.html
Title: Re: Open LDAP Integration
Post by: lionCoolKing on July 20, 2011, 01:15:37 pm
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
Title: Re: Open LDAP Integration
Post by: lionCoolKing on July 21, 2011, 03:12:07 am
please help me get out this......... :(