我必须在GWT中使用LDAP进行简单的登录认证。 我已经完成了Java.But我不知道在GWT中实现相同。 帮助我,如果有人知道...
我粘贴在这里我的Java源代码在这里:
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我在GWT做..
您必须将其公开为[远程servlet服务](https://developers.google.com/web-toolkit/doc/latest/tutorial/RPC)并从您的GWT代码中使用它 – shyam 2013-05-02 11:58:53