fr.paris.lutece.plugins.mylutece.modules.wssodatabase.authentication.util
Class LdapUtil

java.lang.Object
  extended by fr.paris.lutece.plugins.mylutece.modules.wssodatabase.authentication.util.LdapUtil

public final class LdapUtil
extends Object

Classe utilitaire de connexion au LDAP


Method Summary
static DirContext bindUser(String strLDAPContext, String strLDAPUrl, String strDN, String strPassword)
          Connects an user to the ldap
static void freeContext(DirContext context)
          Free the context
static DirContext getContext(String strLDAPContext, String strLDAPUrl, String strAdminDN, String strAdminPassword)
          Search LDAP context
static NamingEnumeration 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
Search LDAP context

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

freeContext

public static void freeContext(DirContext context)
                        throws NamingException
Free the context

Parameters:
context - the context to free
Throws:
NamingException - in case of error

bindUser

public static DirContext bindUser(String strLDAPContext,
                                  String strLDAPUrl,
                                  String strDN,
                                  String strPassword)
                           throws NamingException
Connects an user to the ldap

Parameters:
strLDAPContext - the ldap context
strLDAPUrl - the ldap url
strDN - the dn
strPassword - the password
Returns:
a DirContext object
Throws:
NamingException - in case of error

searchUsers

public static NamingEnumeration searchUsers(DirContext context,
                                            String strFilter,
                                            String strUserDN,
                                            String strDNBase,
                                            SearchControls sc)
                                     throws NamingException
Parameters:
context - the ldap context
strFilter - the filter
strUserDN - the user dn
strDNBase - the base dn
sc - the search controls
Returns:
an enumeration of found elements
Throws:
NamingException - in case of error


Copyright © 2013 Mairie de Paris. All Rights Reserved.