Class LdapMapUtil
- java.lang.Object
- 
- org.keycloak.models.map.storage.ldap.store.LdapMapUtil
 
- 
 public class LdapMapUtil extends Object Utility class for working with LDAP. - Author:
- Pedro Igor
 
- 
- 
Constructor SummaryConstructors Constructor Description LdapMapUtil()
 - 
Method SummaryAll Methods Static Methods Concrete Methods Modifier and Type Method Description static StringconvertGUIDToEdirectoryHexString(String guid)see http://support.novell.com/docs/Tids/Solutions/10096551.htmlstatic StringconvertObjectGUIDToByteString(byte[] objectGUID)Creates a byte-basedStringrepresentation of a raw byte array representing the value of theobjectGUIDattribute retrieved from Active Directory.static StringdecodeGuid(byte[] guid)Decode a raw byte array representing the value of theguidattribute retrieved from Novell eDirectory.static StringdecodeObjectGUID(byte[] objectGUID)Decode a raw byte array representing the value of theobjectGUIDattribute retrieved from Active Directory.static byte[]encodeObjectGUID(String displayString)Encode a string representing the display value of theobjectGUIDattribute retrieved from Active Directory.static StringformatDate(Date date)Formats the given date.static DateparseDate(String date)Parses dates/time stamps stored in LDAP.
 
- 
- 
- 
Method Detail- 
formatDatepublic static String formatDate(Date date) Formats the given date. - Parameters:
- date- The Date to format.
- Returns:
- A String representing the formatted date.
 
 - 
parseDatepublic static Date parseDate(String date) 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.
 
 - 
convertObjectGUIDToByteStringpublic static String convertObjectGUIDToByteString(byte[] objectGUID) Creates a byte-based Stringrepresentation of a raw byte array representing the value of theobjectGUIDattribute retrieved from Active Directory.The returned string is useful to perform queries on AD based on the objectGUIDvalue. Eg.:String filter = "(&(objectClass=*)(objectGUID" + EQUAL + convertObjectGUIDToByteString(objectGUID) + "))"; - Parameters:
- objectGUID- A raw byte array representing the value of the- objectGUIDattribute 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]
 
 - 
convertGUIDToEdirectoryHexStringpublic static String convertGUIDToEdirectoryHexString(String guid) 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]
 
 - 
encodeObjectGUIDpublic static byte[] encodeObjectGUID(String displayString) Encode a string representing the display value of the objectGUIDattribute 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 objectGUIDattribute retrieved from Active Directory.
 
 - 
decodeObjectGUIDpublic static String decodeObjectGUID(byte[] objectGUID) Decode a raw byte array representing the value of the objectGUIDattribute 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 the- objectGUIDattribute 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].
 
 - 
decodeGuidpublic static String decodeGuid(byte[] guid) Decode a raw byte array representing the value of the guidattribute retrieved from Novell eDirectory.- Parameters:
- guid- A raw byte array representing the value of the- guidattribute 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].
 
 
- 
 
-