Re: Connect Directory Services : invalid credentials
Re: Connect Directory Services : invalid credentials
- Subject: Re: Connect Directory Services : invalid credentials
- From: WebObjects - Anazys <email@hidden>
- Date: Wed, 12 Aug 2009 00:18:49 +0200
Hello everybody,
I try to connect to Directory Services via WO.
I successfully connect EOModeler to my LDAP server.
But now I want to authenticate with a login and password to the
Directory Services. After many different test, I didn't know how to do
that.
I also try Novell API but with the same result..
My last try was with LdapContext and com.sun.jndi.ldap.LdapCtxFactory
but I always have a [LDAP: error code 49 - Invalid Credentials] for
all my tests.
My code was nearly that, I think I tried all possible combination :
uid, cn
LdapContext ctx1;
Hashtable env = newHashtable(11);
env.put(Context.INITIAL_CONTEXT_FACTORY,
"com.sun.jndi.ldap.LdapCtxFactory");
env.put(Context.PROVIDER_URL, "ldap://<IP_SERVER>:389/
dc=<SERVER>,dc=<DOMAIN>,dc=com");
env.put(Context.SECURITY_AUTHENTICATION, "simple" );
env.put(Context.SECURITY_PRINCIPAL, "uid=<SHORT_NAME>");
env.put(Context.SECURITY_CREDENTIALS, <PASSWORD_STRING> );
try {
ctx1 = new InitialLdapContext(env, null);
ctx1.close();
}
Maybe the password can't be send in clear text. I also tried with
slappasswd (OpenLDAP password utility) to encrypt the password but I
have the same error...
Somebody succeed to use these API or another solution ?
Maybe I miss something..
My server is MacOSX 10.5.7
Thanks
Cedric
Le 7 oct. 05 à 20:19, Chuck Hill a écrit :
On Oct 6, 2005, at 7:53 PM, .::welemski::. wrote:
Hi,
I tried binding to ldap using this syntax in webobjects
String strCredentials;
// strCredentials="uid="+varUsername+",cn=users";
// Set up environment for creating initial context
Hashtable env = new Hashtable(11);
env.put(Context.INITIAL_CONTEXT_FACTORY,
"com.sun.jndi.ldap.LdapCtxFactory");
env.put(Context.PROVIDER_URL,
"ldap://server.domain.com:389/dc=server,dc=comainl,dc=com");
// Authenticate as S. User and password "mysecret"
env.put(Context.SECURITY_AUTHENTICATION, "simple");
//env.put(Context.SECURITY_PRINCIPAL, "cn=S. User,
ou=NewHires,
o=JNDITutorial");
env.put(Context.SECURITY_PRINCIPAL, "cn=Directory
Administrator,dc=domain,dc=com");
try userid=<user id> instead of cn=Directory Administrator
Chuck
env.put(Context.SECURITY_CREDENTIALS, "mypassword");
try {
// Create initial context
DirContext ctx = new InitialDirContext(env);
System.out.println(ctx.lookup("ou=People"));
// do something useful with ctx
varResult=":D";
// Close the context when we're done
ctx.close();
} catch (NamingException e) {
varResult=":(";
e.printStackTrace();
}
but I get an error, "Invalid Credentials". my password is correct
--
-- -- -- -- -- -- -- -- -- -- --
welemski
-- -- -- -- -- -- -- -- -- -- --
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Webobjects-dev mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden
--
Coming in 2006 - an introduction to web applications using
WebObjects and Xcode http://www.global-village.net/wointro
Practical WebObjects - for developers who want to increase their
overall knowledge of WebObjects or who are trying to solve specific
problems. http://www.global-village.net/products/practical_webobjects
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Webobjects-dev mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Webobjects-dev mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden