Class LdapMapUtil
Utility class for working with LDAP.
- Author:
- Pedro Igor
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionstatic String
see http://support.novell.com/docs/Tids/Solutions/10096551.htmlstatic String
convertObjectGUIDToByteString
(byte[] objectGUID) Creates a byte-basedString
representation of a raw byte array representing the value of theobjectGUID
attribute retrieved from Active Directory.static String
decodeGuid
(byte[] guid) Decode a raw byte array representing the value of theguid
attribute retrieved from Novell eDirectory.static String
decodeObjectGUID
(byte[] objectGUID) Decode a raw byte array representing the value of theobjectGUID
attribute retrieved from Active Directory.static byte[]
encodeObjectGUID
(String displayString) Encode a string representing the display value of theobjectGUID
attribute retrieved from Active Directory.static String
formatDate
(Date date) Formats the given date.static Date
Parses dates/time stamps stored in LDAP.static boolean
shouldUseTruststoreSpi
(LdapMapConfig ldapConfig)
-
Constructor Details
-
LdapMapUtil
public LdapMapUtil()
-
-
Method Details
-
formatDate
Formats the given date.
- Parameters:
date
- The Date to format.- Returns:
- A String representing the formatted date.
-
parseDate
Parses dates/time stamps stored in LDAP. Some possible values:
- 20020228150820
- 20030228150820Z
- 20050228150820.12
- 20060711011740.0Z
- Parameters:
date
- The date string to parse from.- Returns:
- the Date.
-
convertObjectGUIDToByteString
Creates a byte-based
String
representation of a raw byte array representing the value of theobjectGUID
attribute retrieved from Active Directory.The returned string is useful to perform queries on AD based on the
objectGUID
value. Eg.:String filter = "(&(objectClass=*)(objectGUID" + EQUAL + convertObjectGUIDToByteString(objectGUID) + "))";
- Parameters:
objectGUID
- A raw byte array representing the value of theobjectGUID
attribute retrieved from Active Directory.- Returns:
- A byte-based String representation in the form of \[0]\[1]\[2]\[3]\[4]\[5]\[6]\[7]\[8]\[9]\[10]\[11]\[12]\[13]\[14]\[15]
-
convertGUIDToEdirectoryHexString
see http://support.novell.com/docs/Tids/Solutions/10096551.html- Parameters:
guid
- A GUID in the form of a dashed String as the result of (@see LDAPUtil#convertToDashedString)- Returns:
- A String representation in the form of \[0][1]\[2][3]\[4][5]\[6][7]\[8][9]\[10][11]\[12][13]\[14][15]
-
encodeObjectGUID
Encode a string representing the display value of the
objectGUID
attribute retrieved from Active Directory.- Parameters:
displayString
- A string representing the decoded value in the form of [3][2][1][0]-[5][4]-[7][6]-[8][9]-[10][11][12][13][14][15].- Returns:
- A raw byte array representing the value of the
objectGUID
attribute retrieved from Active Directory.
-
decodeObjectGUID
Decode a raw byte array representing the value of the
objectGUID
attribute retrieved from Active Directory.The returned string is useful to directly bind an entry. Eg.:
String bindingString = decodeObjectGUID(objectGUID);
Attributes attributes = ctx.getAttributes(bindingString);- Parameters:
objectGUID
- A raw byte array representing the value of theobjectGUID
attribute retrieved from Active Directory.- Returns:
- A string representing the decoded value in the form of [3][2][1][0]-[5][4]-[7][6]-[8][9]-[10][11][12][13][14][15].
-
decodeGuid
Decode a raw byte array representing the value of the
guid
attribute retrieved from Novell eDirectory.- Parameters:
guid
- A raw byte array representing the value of theguid
attribute retrieved from Novell eDirectory.- Returns:
- A string representing the decoded value in the form of [0][1][2][3]-[4][5]-[6][7]-[8][9]-[10][11][12][13][14][15].
-
shouldUseTruststoreSpi
-