Florian Ajir
Florian Ajir

Reputation: 4414

Java -> LDAP account password encryption

I have an Ldap directory synchronised from a microsoft active directory.

This Ldap contain many account, each account have a password attribute.

I must develop a java program where a user have to log with his AD login and password, but i don't know the method employed to correctly encrypt the password typed.

I need it to compare with the ldap password.

I also need to bind new account with the same password encryption.

Anyone know how to do?

Upvotes: 2

Views: 2587

Answers (2)

Florian Ajir
Florian Ajir

Reputation: 4414

I've found the solution with spring,

here the method to test login/pass couple :

AndFilter filter = new AndFilter();
filter.and(new EqualsFilter("objectclass", "person")).and(new EqualsFilter("cn", login));
boolean authentifie = ldapTemplate.authenticate(DistinguishedName.EMPTY_PATH, filter.toString(), password);

Upvotes: 1

MJB
MJB

Reputation: 9399

Well first of all you can use a BIND with SSL, but that's considered kind of the lame way to go about it and may be disabled on some systems. A truly secure way is using SPNEGO-GSS, and this is not trivial. You have to learn and understand about Kerberos. That's a long topic but you can start with reading and going through everything here

Upvotes: 1

Related Questions