public class LdapUtils extends Object
Modifier and Type | Method and Description |
---|---|
static void |
closeNamingEnumeration(NamingEnumeration<?> enumeration)
Close a naming enumeration to free up resources.
|
static String |
convertToByteFormatString(byte[] bytes)
Converts the bytes to a string in LDAP bytes format.
|
static boolean |
dnConformsToSearchBaseDefinitions(String dn,
Collection<LdapSearchBaseDefinition> searchBaseDefs)
Tests whether a DN conforms to at least on of the search bases.
|
static String |
escapeLdapSearchFilterValue(String value)
Escapes an LDAP search filter value according to RFC 2254 (Section 4).
|
static List<String> |
getAttributeValues(Attributes attributes,
String ldapAttributeName)
Returns the values for the named LDAP attribute.
|
static ExternalUserVO |
queryUserByName(String emailOrAlias)
Do an LDAP query for a user by email or alias.
|
static void |
setSynchronizationFields(ExternalUserVO userVO)
Sets the fields of the user to be updated.
|
static Pair<String,String> |
splitAfterFirstRdn(String dn)
Strips the first RDN from a DN and returns a pair where the left element is the stripped of
RDN and the right element holds the rest.
|
public static void closeNamingEnumeration(NamingEnumeration<?> enumeration)
enumeration
- the enumeration to close. If null, this method does nothing.public static String convertToByteFormatString(byte[] bytes)
bytes
- the bytes to convertpublic static boolean dnConformsToSearchBaseDefinitions(String dn, Collection<LdapSearchBaseDefinition> searchBaseDefs)
dn
- the DN to testsearchBaseDefs
- the search base definitionpublic static String escapeLdapSearchFilterValue(String value)
value
- the value to be escapedpublic static List<String> getAttributeValues(Attributes attributes, String ldapAttributeName) throws LdapAttributeMappingException
attributes
- the attributes from which the value should be extractedldapAttributeName
- the name of the attribute in LDAPLdapAttributeMappingException
- if there was an error while retrieving the valuepublic static ExternalUserVO queryUserByName(String emailOrAlias)
emailOrAlias
- email or alias of LDAP userpublic static void setSynchronizationFields(ExternalUserVO userVO)
userVO
- the VOpublic static Pair<String,String> splitAfterFirstRdn(String dn)
dn
- the DN to splitCopyright © 2019 Communote team. All rights reserved.