Package fr.paris.lutece.util.ldap
Class LdapUtil
java.lang.Object
fr.paris.lutece.util.ldap.LdapUtil
This class provides LDAP generic connection methods
-
Method Summary
Modifier and TypeMethodDescriptionstatic DirContextstatic voidfreeContext(DirContext context) Close the context given in parameterstatic DirContextgetContext(String strLDAPContext, String strLDAPUrl, String strAdminDN, String strAdminPassword) LDAP Context searchstatic NamingEnumeration<SearchResult>searchUsers(DirContext context, String strFilter, String strUserDN, String strDNBase, SearchControls sc)
-
Method Details
-
getContext
public static DirContext getContext(String strLDAPContext, String strLDAPUrl, String strAdminDN, String strAdminPassword) throws NamingException LDAP Context search- Parameters:
strLDAPContext- the contextstrLDAPUrl- the urlstrAdminDN- the admin dn to usestrAdminPassword- the admin password to use- Returns:
- a DirContext object
- Throws:
NamingException- in case of error
-
freeContext
Close the context given in parameter- Parameters:
context- the LDAP context as a DirContext object- Throws:
NamingException- in case of error
-
bindUser
public static DirContext bindUser(String strLDAPContext, String strLDAPUrl, String strDN, String strPassword) throws NamingException - Parameters:
strLDAPContext- the contextstrLDAPUrl- the urlstrDN- the dn of the user to connectstrPassword- the password of the user to connect- Returns:
- a DirContext object
- Throws:
NamingException- in case of error
-
searchUsers
public static NamingEnumeration<SearchResult> searchUsers(DirContext context, String strFilter, String strUserDN, String strDNBase, SearchControls sc) throws NamingException - Parameters:
context- the contextstrFilter- the filter for the searchstrUserDN- the user dnstrDNBase- the base dnsc- the SearchControls- Returns:
- an enumeration of the elements found
- Throws:
NamingException- in case of error
-