0

Hi Friends,

I have to do a Simple login authentication using LDAP in GWT. I had done in Java.But i don't know to implement the same in GWT. Help me if anyone knows...
I pasted here my java source here :

package com.ldap.test;
import java.util.*;
import javax.naming.*;
import javax.naming.directory.*;
public class ldaptest {

    @SuppressWarnings("unchecked")
    public static void main(String[] args) {

         try {
            @SuppressWarnings("rawtypes")
            Hashtable env = new Hashtable();
            env.put(Context.INITIAL_CONTEXT_FACTORY,
                     "com.sun.jndi.ldap.LdapCtxFactory");
            env.put(Context.PROVIDER_URL,
                     "LDAP://localhost:389"); //replace with your server URL/IP
                     //only DIGEST-MD5 works with our Windows Active Directory
            env.put(Context.SECURITY_AUTHENTICATION,
                     "Simple"); //No other SALS worked with me
            env.put(Context.SECURITY_PRINCIPAL,
                    "uid=karthick,ou=users,ou=system"); // specify the username ONLY to let Microsoft Happy
            env.put(Context.SECURITY_CREDENTIALS, "karthick");   //the password

            DirContext ctx = new InitialDirContext(env);

            ctx.close();
    enter code here
          } catch(NamingException ne) {
            System.out.println("Error authenticating user:");
            System.out.println(ne.getMessage());
            return;
        }

          //if no exception, the user is already authenticated.
          System.out.println("OK, successfully authenticating user");
        }

}

// samething i have to do in GWT..

4

2 回答 2

1

Implement a remote servlet service, pass the username and credentials to the service through a asynchronous callback in the client side. The above code can work as the implementation.

于 2014-01-29T06:49:07.397 回答
0

Lupo,一个简单的工具,用于管理基于 GWT 的 LDAP 中的用户条目。

源代码:https ://code.google.com/p/lupo/source/browse/trunk/

于 2013-10-23T21:26:51.633 回答