fr.paris.lutece.util.ldap
Class LdapUtil

java.lang.Object
  extended by fr.paris.lutece.util.ldap.LdapUtil

public final class LdapUtil
extends Object

This class provides LDAP generic connection methods


Method Summary
static DirContext bindUser(String strLDAPContext, String strLDAPUrl, String strDN, String strPassword)
           
static void freeContext(DirContext context)
          Close the context given in parameter
static DirContext getContext(String strLDAPContext, String strLDAPUrl, String strAdminDN, String strAdminPassword)
          LDAP Context search
static NamingEnumeration<SearchResult> searchUsers(DirContext context, String strFilter, String strUserDN, String strDNBase, SearchControls sc)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Method Detail

getContext

public static DirContext getContext(String strLDAPContext,
                                    String strLDAPUrl,
                                    String strAdminDN,
                                    String strAdminPassword)
                             throws NamingException
LDAP Context search

Parameters:
strLDAPContext - the context
strLDAPUrl - the url
strAdminDN - the admin dn to use
strAdminPassword - the admin password to use
Returns:
a DirContext object
Throws:
NamingException - in case of error

freeContext

public static void freeContext(DirContext context)
                        throws NamingException
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 context
strLDAPUrl - the url
strDN - the dn of the user to connect
strPassword - 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 context
strFilter - the filter for the search
strUserDN - the user dn
strDNBase - the base dn
sc - the SearchControls
Returns:
an enumeration of the elements found
Throws:
NamingException - in case of error


Copyright © 2014 Mairie de Paris. All Rights Reserved.