Update or modify LDAP entry using java JNDI

LDAP entry contains more attributes  . Update or modify LDAP entry by updating its attributes with JNDI.

Basic requirements for authentication :

Update or modify LDAP entry IP address and port of the LDAP server.

Update or modify LDAP entry LDAP Admin DN and password.


Example LDAP directory structure :



Process to update or modify LDAP entry  :

Update or modify LDAP entry  First connect to the LDAP server  as an admin (having access to add) .

Update or modify LDAP entry  Prepare DN to update specific entry .

………Example: If you want to update the entry uid=145 in ou=physics directory,then the  DN will be  ………uid=145,ou=physics,dc=sciencedep,dc=college .

Update or modify LDAP entry   Assign new values to the attributes that you have to update .


Example to Update or modify LDAP entry :

Execution Result:

From the above example :

  ldaps:// is the LDAP server URL (IP and Port).

  cn=LDAP Administrator, dc=college, dc=org, dc=in Administrator DN to Update or modify LDAP entry .

  Connection type is “simple” ,that means  it will take the plain text as password for authentication.

  uid=142,ou=alzebra,dc=mathsdep,dc=college,dc=org,dc=in   is the  entry DN that we need to update .

  Line number 59 and 60 , passing new value (L)  to the jpjuserstatus attribute .

  Finally , the dirContext.modifyAttributes(entryDN, modItemsOne) method will update the Entry .


Related Posts :
How to Connect to Oracle from Liferay portlet ( Java Liferay and Oracle integration )
How to Connect Liferay 7 to PostgreSQL ( Java Liferay portlet and PostgreSQL integration )
How to call C# .Net WCF web service in java SOAP client ( Visual Studio 2013 )
How to call PHP RESTful web service in java client
How to call java SOAP web service in php ( php web service client )
Solution to SSLHandshakeException (skip the certificate for Java and LDAP bind)
Java RESTful web service example in maven using JAX-RS
RESTful web service example in java using JAX-RS
   [will not be published]

^ <