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

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

public final class LdapUtil
extends java.lang.Object

Classe utilitaire de connexion au LDAP


Method Summary
static javax.naming.directory.DirContext bindUser(java.lang.String strLDAPContext, java.lang.String strLDAPUrl, java.lang.String strDN, java.lang.String strPassword)
          Connects an user to the ldap
static void freeContext(javax.naming.directory.DirContext context)
          Free the context
static javax.naming.directory.DirContext getContext(java.lang.String strLDAPContext, java.lang.String strLDAPUrl, java.lang.String strAdminDN, java.lang.String strAdminPassword)
          Search LDAP context
static javax.naming.NamingEnumeration searchUsers(javax.naming.directory.DirContext context, java.lang.String strFilter, java.lang.String strUserDN, java.lang.String strDNBase, javax.naming.directory.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 javax.naming.directory.DirContext getContext(java.lang.String strLDAPContext,
                                                           java.lang.String strLDAPUrl,
                                                           java.lang.String strAdminDN,
                                                           java.lang.String strAdminPassword)
                                                    throws javax.naming.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:
javax.naming.NamingException - in case of error

freeContext

public static void freeContext(javax.naming.directory.DirContext context)
                        throws javax.naming.NamingException
Free the context

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

bindUser

public static javax.naming.directory.DirContext bindUser(java.lang.String strLDAPContext,
                                                         java.lang.String strLDAPUrl,
                                                         java.lang.String strDN,
                                                         java.lang.String strPassword)
                                                  throws javax.naming.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:
javax.naming.NamingException - in case of error

searchUsers

public static javax.naming.NamingEnumeration searchUsers(javax.naming.directory.DirContext context,
                                                         java.lang.String strFilter,
                                                         java.lang.String strUserDN,
                                                         java.lang.String strDNBase,
                                                         javax.naming.directory.SearchControls sc)
                                                  throws javax.naming.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:
javax.naming.NamingException - in case of error


Copyright © 2007 Mairie de Paris. All Rights Reserved.