crazypaladin
crazypaladin

Reputation: 453

LDAP Authentication Requirements and How to do it

I need to access a website and get information through it. I need to pass through an ldap authentication in ie for this.i just know the ip of the LDAP server.I thought of doing this through JNDI but still I don't know how to get the parameters of the server for authentication. Could someone tell me how to pass on the authentication connecting to this server.

Upvotes: 0

Views: 1324

Answers (3)

Andrew White
Andrew White

Reputation: 53486

With a rather vague question I am just going to point you to Spring LDAP which is easy to use and has good documentation on all things related to LDAP and Java.

Upvotes: 1

user806168
user806168

Reputation: 477

you "need" the information about the server's (host) ip or name and the base DN of the directory where you entries are. you aren't going to find this anywhere - these will be specified by the server that you are trying to connect to.

This is how you generally authenticate against a ldap server:

  1. Get login (or email) and password from user.
  2. Bind to the LDAP server anonymously (or using a service account if anonymous binds are disabled)
  3. Search the directory using an appropriate filter to identify the record for the specific login name provided.
  4. If one and only one entry is returned, that is the entry you want - get the DN of the entry. (If zero, or more than one entries are returned, return "no such user")
  5. Re-bind to the LDAP directory using the DN returned in step 4 and the password from step 1
  6. If the LDAP server allows the bind, the login is successful. Otherwise, return "invalid password"

Upvotes: 0

user207421
user207421

Reputation: 310840

You can't 'find' it, and you can't 'get' the server parameters for authentication either. You have to know it all in advance. You can make this stuff configuration parameters of your Web-app. In Tomcat you can define an LDAP Resource in context.xml and support it via an LdapObectFactory as described in the Tomcat Resource documentation.

Upvotes: 0

Related Questions