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 StringencodeFilterValue(String value)Escape a value for use in a filter.static StringfindFirstRdnValue(LdapName name, String type)Returns the first RDN value that matches the given type.static StringgetAttributeValue(Attributes attributes, String attrName, String attributeDescription)static StringgetAttributeValueFromByteArray(Attributes attributes, String attrName, String attributeDescription)static StringgetLabeledUriValue(Attributes attributes, String attrName, String label, String attributeDescription)static LdapNamegetLdapNameFromString(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. Thenameparameter 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.
-
-