LDAP Authention Error

Hi,ALL

I use LDAP to access Windows 2003 server active directory.

It works pretty good.

However, since some reason, I have reinstalled windows 2003 server.

and my LDAP can not pass authencation.

Error:

LDAP: error code 49 - 80090308: LdapErr: DSID-0C090334, comment: AcceptSecurityContext error, data 525, vece

The account which I used is administrator/admin

If I use Softerra LDAP Browser 2.6 tool to access active directory.

It works.

my code is:

props = new Properties();

props.put(Context.PROVIDER_URL,LDAP+host+LDAP_PORT+"/");

props.put(Context.INITIAL_CONTEXT_FACTORY,CONTECT_FACTORY);

props.put(Context.SECURITY_PRINCIPAL,domain+"\\"+user);

props.put(Context.SECURITY_CREDENTIALS,password);

props.put(Context.SECURITY_AUTHENTICATION,AUTH_SIMP);

try{

context = new InitialDirContext(props);

}catch(Exception ex){

Logger.log(ex.toString());

}

Any suggestion would be great appreciated

[1028 byte] By [lvguangchuana] at [2007-10-2 15:01:21]
# 1

Hi,ALL

Thanks,I have found a solution.

however, I do not reason.Is there any body can explain to me.

I change this line

props.put(Context.SECURITY_PRINCIPAL,domain+"\\"+user);

to

props.put(Context.SECURITY_PRINCIPAL,"user@domain.com");

it works for me.

who can explain me the differece between these line.

Thanks

lvguangchuana at 2007-7-13 13:47:31 > top of Java-index,Security,Other Security APIs, Tools, and Issues...
# 2
Hi, Thanks, this solution works. props.put(Context.SECURITY_PRINCIPAL,domain+"\\"+user); to props.put(Context.SECURITY_PRINCIPAL,"user@domain.com");
shekargowdaa at 2007-7-13 13:47:31 > top of Java-index,Security,Other Security APIs, Tools, and Issues...
# 3

Hi

I need to solve a similar problem where I will need to validate a user via LDAP, I did a quick google and did not find an easy way to do this, it seems that the code snippet you provided here works for you. I assume Properties is java.util.properties, but I wonder what is the Context and how do you obtain it?

Could you please explain it a bit more in detail?

Thanks a lot ,

winia at 2007-7-13 13:47:31 > top of Java-index,Security,Other Security APIs, Tools, and Issues...
# 4
hi :-)please check the link below http://java.sun.com/products/jndi/tutorial/ldap/security/ldap.htmlit's a tutorial about JNDI and LDAP, kindly just explore the tutorial.Regards :-)
jie2eea at 2007-7-13 13:47:31 > top of Java-index,Security,Other Security APIs, Tools, and Issues...
# 5

Hi jie2ee,

Thanks a lot for the reply, I actually saw that post and it is indeed the one I followed yesterday. Now I think I know how to make LDAP check :)

I wonder if you happen to know if there is a way to know a user, given just username and password, can be authenticated on the local system? I need to allow a user as long as the Credentials are either valid local account ( both windows and unix ) or valid LDAP account.

Regards,

winia at 2007-7-13 13:47:31 > top of Java-index,Security,Other Security APIs, Tools, and Issues...
# 6
hello wini :-)i'm sad to say that i only tried LDAP authentication in a web applicationand not on local system as login but what you said is possible i just haven't tried that one :-(
jie2eea at 2007-7-13 13:47:31 > top of Java-index,Security,Other Security APIs, Tools, and Issues...
# 7

Hi jie2ee:

Thank you very much for your kind reply, I got my way around it on windows by writing a simple console program in c# using PInvoke ( which does authentication for me ) and use Runtime.getRuntime.exec API to lunch the .net exe

I am trying to do the same on the Linux side by using su command, but I know very very little about Unix, not to say to write shell script stuff :)

Have a wonder day

w.

winia at 2007-7-13 13:47:31 > top of Java-index,Security,Other Security APIs, Tools, and Issues...