com.jalios.ldap
Class LDAPUtil

java.lang.Object
  extended by com.jalios.ldap.LDAPUtil

public class LDAPUtil
extends Object

Version:
$Revision: 39755 $
Author:
Olivier Jaquemet

Field Summary
static String OBJECT_CLASS_ATTR
          "objectClass"
static String REVISION
           
 
Constructor Summary
LDAPUtil()
           
 
Method Summary
static boolean checkConnect(String hostname, String port, String isSSL, String bindDN, String bindPassword)
          Try a LDAP connection using the given host information and credential.
static String escapeDN(String name)
          Escape certain meta-characters in LDAP DN.
static String escapeLDAPSearchFilter(String filter)
          Escape certain meta-characters of a name for use in LDAP search filter.
static String getString(netscape.ldap.LDAPAttribute attribute, String defaultValue)
          Return first available value of LDAPAttribute attr, or defaultValue if not available.
static boolean isGroupEntry(netscape.ldap.LDAPEntry entry, LDAPConfiguration conf)
          Determines if the given LDAPEntry is a group entry according to parameters specified by the given LDAPConfiguration object.
static boolean isUserEntry(netscape.ldap.LDAPEntry entry, LDAPConfiguration conf)
          Determines if the given LDAPEntry is a user entry according to parameters specified by the given LDAPConfiguration object.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

REVISION

public static final String REVISION
See Also:
Constant Field Values

OBJECT_CLASS_ATTR

public static final String OBJECT_CLASS_ATTR
"objectClass"

See Also:
Constant Field Values
Constructor Detail

LDAPUtil

public LDAPUtil()
Method Detail

getString

public static String getString(netscape.ldap.LDAPAttribute attribute,
                               String defaultValue)
Return first available value of LDAPAttribute attr, or defaultValue if not available.

Parameters:
attribute - LDAPAttribute from which to retrieve value.
defaultValue - the default value to use if none could be read
Returns:
a the first value of attr or defaultValue (never return null unless defaultValue is null).

isGroupEntry

public static boolean isGroupEntry(netscape.ldap.LDAPEntry entry,
                                   LDAPConfiguration conf)
Determines if the given LDAPEntry is a group entry according to parameters specified by the given LDAPConfiguration object.

Parameters:
entry - the LDAPEntry to check
conf - the LDAPConfiguration to use, MUST NOT be null
Returns:
true if the entry is a group, false otherwise
Since:
jcms-5.7

isUserEntry

public static boolean isUserEntry(netscape.ldap.LDAPEntry entry,
                                  LDAPConfiguration conf)
Determines if the given LDAPEntry is a user entry according to parameters specified by the given LDAPConfiguration object.

Parameters:
entry - the LDAPEntry to check
conf - the LDAPConfiguration to use, MUST NOT be null
Returns:
true if the entry is a user, false otherwise
Since:
jcms-5.7

checkConnect

public static boolean checkConnect(String hostname,
                                   String port,
                                   String isSSL,
                                   String bindDN,
                                   String bindPassword)
Try a LDAP connection using the given host information and credential.

Parameters:
hostname - the hostname of the ldap server to connect to.
port - the port of the ldap server to connect to.
isSSL - whether the connection should be made using SSL.
bindDN - the Distinguished Name to use to bind to the ldap server to connect to.
bindPassword - the password to use to bind to the ldap server to connect to.
Returns:
true if the connection was successful, false if an error occured
Since:
jcms-5.7

escapeDN

public static String escapeDN(String name)
Escape certain meta-characters in LDAP DN.

Parameters:
name - the name to escape
Returns:
the escaped name

escapeLDAPSearchFilter

public static final String escapeLDAPSearchFilter(String filter)
Escape certain meta-characters of a name for use in LDAP search filter.

Parameters:
filter - the filter to escape
Returns:
the escaped filter


Copyright © 2001-2010 Jalios SA. All Rights Reserved.