Class LdapUtils
- java.lang.Object
-
- org.apache.archiva.redback.common.ldap.LdapUtils
-
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static String
encodeFilterValue(String value)
Escape a value for use in a filter.static String
findFirstRdnValue(LdapName name, String type)
Returns the first RDN value that matches the given type.static String
getAttributeValue(Attributes attributes, String attrName, String attributeDescription)
static String
getAttributeValueFromByteArray(Attributes attributes, String attrName, String attributeDescription)
static String
getLabeledUriValue(Attributes attributes, String attrName, String label, String attributeDescription)
static LdapName
getLdapNameFromString(String name)
Returns a LDAP name from a given RDN string.
-
-
-
Method Detail
-
getLabeledUriValue
public static String getLabeledUriValue(Attributes attributes, String attrName, String label, String attributeDescription) throws MappingException
- Throws:
MappingException
-
getAttributeValue
public static String getAttributeValue(Attributes attributes, String attrName, String attributeDescription) throws MappingException
- Throws:
MappingException
-
getAttributeValueFromByteArray
public static String getAttributeValueFromByteArray(Attributes attributes, String attrName, String attributeDescription) throws MappingException
- Throws:
MappingException
-
getLdapNameFromString
public static LdapName getLdapNameFromString(String name) throws InvalidNameException
Returns a LDAP name from a given RDN string. Thename
parameter must be a string representation of a composite name (as returned by ldapsearch result getName())- Parameters:
name
- The string of the RDN (may be escaped)- Returns:
- The LdapName that corresponds to this string
- Throws:
InvalidNameException
- If the string cannot be parsed as LDAP name
-
findFirstRdnValue
public static String findFirstRdnValue(LdapName name, String type)
Returns the first RDN value that matches the given type. E.g. for the RDN ou=People,dc=test,dc=de, and type dc it will return 'test'.- Parameters:
name
- the ldap nametype
- the type of the RDN entry- Returns:
-
encodeFilterValue
public static String encodeFilterValue(String value)
Escape a value for use in a filter. This method is copied from the spring framework class org.springframework.security.ldap.authentication.LdapEncoder- Parameters:
value
- the value to escape.- Returns:
- a properly escaped representation of the supplied value.
-
-