Connect ldap using java

Tuesday, February 23rd, 2016 (0 Comment)

1. What is LDAP?

LDAP is the acronym for Lightweight Directory Access Protocol. Standards-based LDAP X500 development. This is a standard for directory services (Directory Service – DS) running on the platform OSI.

LDAP is considered lightweight because LDAP uses low overhead packets, are pinpointed on the list TCP layer of TCP / IP (connectionless services) while X500 is heavyweight for the application layer protocol, contains many more header (the header of the lower floor layer).

LDAP is a protocol only, not support such treatment database. It needs a backend storage and data processing in which.

LDAP operate under a client-server model. One or more LDAP servers contain information about the directory tree (Directory Information Tree – DIT). The clients connect to the server and send the request. Server responds with itself or other point to LDAP server to retrieve client information.

2. Example using java connect ldap

2.1. connect ldap with user domain and password

You need import some libraries

Function connect Ldap

  • You can create function login to Ldap and return true if login success, else return false if login failed.

Output:

2.2. connect Ldap and search some information of Ldap

Import some libraries in java

Function search information of Ldap

Function get information user login

  • Line 4: declare base dn of Ldap (example : your domain is google.com.sg –> baseDN : “dc=google,dc=com,dc=sg”)

Main process

Output:

 

Tags: , ,

Related Posts

core java
Export Crystal Report with Subreport in java
core java
Convert xml to object java and vice versa
core java
Java basic tutorial on lvtutorial.com
core java
Java hibernate manytomany to manage user role

Related Posts

core java
Export Crystal Report with Subreport in java
core java
Convert xml to object java and vice versa
core java
Java basic tutorial on lvtutorial.com
core java
Java hibernate manytomany to manage user role

Leave a Reply

Your email address will not be published. Required fields are marked *