public class LDAPUtil
extends java.lang.Object
| Modifier and Type | Class and Description |
|---|---|
static class |
LDAPUtil.SRVRecord
SRV record entry
|
| Modifier and Type | Field and Description |
|---|---|
static java.lang.String |
OBJECT_CLASS_ATTR
"objectClass"
|
static java.lang.String |
REVISION |
| Constructor and Description |
|---|
LDAPUtil() |
| Modifier and Type | Method and Description |
|---|---|
static boolean |
checkConnect(java.lang.String hostname,
java.lang.String port,
java.lang.String isSSL,
java.lang.String bindDN,
java.lang.String bindPassword)
Try a LDAP connection using the given host information and credential.
|
static java.lang.String |
escapeDN(java.lang.String name)
Escape certain meta-characters in LDAP DN.
|
static java.lang.String |
escapeLDAPSearchFilter(java.lang.String filter)
Escape certain meta-characters of a name for use in LDAP search filter.
|
static java.lang.String |
extractSAMAccountName(java.lang.String login)
Retrieve the sAMAccountName from the specified login (if possible).
|
static java.lang.String |
getFirstDomainControllerHostname(java.lang.String domain)
Retrieve the first domain controler available for query for the specified windows domain.
|
static LDAPUtil.SRVRecord |
getFirstSrvRecord(java.lang.String srvRecordName)
Retrieve the first SRV record value for the specified SRV record name.
|
static java.lang.String |
getSid(netscape.ldap.LDAPAttribute objectSidAttribute)
Retrieve a string representation of the specified
objectSid LDAP attribute
which contains a value that specifies the security identifier (SID) of the user. |
static java.util.List<LDAPUtil.SRVRecord> |
getSrvRecords(java.lang.String srvRecordName)
Retrieve all SRV record values for the specified SRV record name.
|
static java.lang.String |
getString(netscape.ldap.LDAPAttribute attribute,
java.lang.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. |
static boolean |
supportsVLV(netscape.ldap.LDAPConnection lc)
Checks if the remote LDAP server support Virtual List View control.
|
public static final java.lang.String REVISION
public static final java.lang.String OBJECT_CLASS_ATTR
public static java.lang.String getString(netscape.ldap.LDAPAttribute attribute,
java.lang.String defaultValue)
LDAPAttribute attr,
or defaultValue if not available.attribute - LDAPAttribute from which to retrieve value.defaultValue - the default value to use if none could be readpublic static boolean isGroupEntry(netscape.ldap.LDAPEntry entry,
LDAPConfiguration conf)
LDAPEntry is a group entry according to parameters
specified by the given LDAPConfiguration object.entry - the LDAPEntry to checkconf - the LDAPConfiguration to use, MUST NOT be nullpublic static boolean isUserEntry(netscape.ldap.LDAPEntry entry,
LDAPConfiguration conf)
LDAPEntry is a user entry according to parameters
specified by the given LDAPConfiguration object.entry - the LDAPEntry to checkconf - the LDAPConfiguration to use, MUST NOT be nullpublic static boolean checkConnect(java.lang.String hostname,
java.lang.String port,
java.lang.String isSSL,
java.lang.String bindDN,
java.lang.String bindPassword)
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.public static java.lang.String escapeDN(java.lang.String name)
name - the name to escapepublic static final java.lang.String escapeLDAPSearchFilter(java.lang.String filter)
filter - the filter to escapepublic static java.lang.String extractSAMAccountName(java.lang.String login)
Support login in Down-Level logon name formats (eg DOMAIN\sAMAccountName).
login - a user loginpublic static java.lang.String getSid(netscape.ldap.LDAPAttribute objectSidAttribute)
objectSid LDAP attribute
which contains a value that specifies the security identifier (SID) of the user.objectSidAttribute - the objectSid as retrieved frompublic static java.lang.String getFirstDomainControllerHostname(java.lang.String domain)
This methods looks for all SRV record "_ldap._tcp.dc._msdcs.{domain}" and return the first one as defined by priority and weight in all records.
domain - a windows domain namepublic static LDAPUtil.SRVRecord getFirstSrvRecord(java.lang.String srvRecordName)
srvRecordName - the name of the SRV record to query, ie "_sip._tcp.example.com."public static java.util.List<LDAPUtil.SRVRecord> getSrvRecords(java.lang.String srvRecordName)
srvRecordName - the name of the SRV record to query, ie "_sip._tcp.example.com."public static boolean supportsVLV(netscape.ldap.LDAPConnection lc)
LDAP v3 MUST have been used prior to binding on the remote LDAP server.
lc - the LDAPConnection already opened on the LDAP serverCopyright © 2001-2010 Jalios SA. All Rights Reserved.