Reputation: 57
my problem is that I had to deploy an application onto a linux server. The authentication is based on a remote active directory. Everything was working fine, but since i have deployed onto the linux server, my authentication no longer works.
This is my authentication code:
public boolean connectUser(String login, String password) {
Hashtable env = new Hashtable();
env.put(Context.INITIAL_CONTEXT_FACTORY,"com.sun.jndi.ldap.LdapCtxFactory");
env.put(Context.PROVIDER_URL, HOST);
env.put(Context.SECURITY_AUTHENTICATION, "simple");
env.put(Context.SECURITY_PRINCIPAL, login+"@nazoos.com");
env.put(Context.SECURITY_CREDENTIALS, password);
// Create the initial context
try {
DirContext ctx = new InitialDirContext(env);
Log.getLogger().debug("UserService : Connexion ==> OK ");
return true;
} catch (NamingException e) {
Log.getLogger().debug("UserService : Erreur Connexion :"+e.getMessage());
return false;
}
}
This is the error that i have
Caused by: java.net.UnknownHostException: nazoos.com
at java.net.AbstractPlainSocketImpl.connect(AbstractPlainSocketImpl.java:178)
at java.net.SocksSocketImpl.connect(SocksSocketImpl.java:392)
at java.net.Socket.connect(Socket.java:579)
at java.net.Socket.connect(Socket.java:528)
at java.net.Socket.<init>(Socket.java:425)
at java.net.Socket.<init>(Socket.java:208)
at com.sun.jndi.ldap.Connection.createSocket(Connection.java:368)
at com.sun.jndi.ldap.Connection.<init>(Connection.java:203)
... 54 more
I have searched a lot, but I couldn't find anything.
Upvotes: 0
Views: 690
Reputation: 171
ldap://<IP_or_hostname>:389
Upvotes: 1