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 Summary
Constructors Constructor Description LdapMapUtil()
-
Method Summary
All 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
-
formatDate
public static String formatDate(Date date)
Formats the given date.
- Parameters:
date- The Date to format.- Returns:
- A String representing the formatted date.
-
parseDate
public 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.
-
convertObjectGUIDToByteString
public 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 theobjectGUIDattribute 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
public 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]
-
encodeObjectGUID
public 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.
-
decodeObjectGUID
public 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 theobjectGUIDattribute 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
public 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 theguidattribute 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].
-
-