I am trying to fetch, store and in turn use objectGUID to query Active directory. To get user attributes i am using following
public static class MyDnKeyValueAttMapper implements AttributesMapper<Object> {
@Override
public List<LdapKeyValueList> mapFromAttributes(Attributes attributes)
throws NamingException, javax.naming.NamingException {
List<LdapKeyValueList> attributeKeyValMap = new ArrayList<LdapKeyValueList>();
NamingEnumeration<String> namingEnumeration = attributes.getIDs();
while (namingEnumeration.hasMoreElements()) {
String attributeName = (String) namingEnumeration.nextElement();
String AttributeValue = attributes.get(attributeName).get().toString();
attributeKeyValMap.add(new LdapKeyValueList(attributeName, AttributeValue));
}
return attributeKeyValMap;
}
}
objectGuid always seems to be returned in string format. I have also tried -
UUID guid = (UUID) attributes.get("objectGUID").get();
This throws error of "cannot convert string to uuid"
Seems like before i can do anything ldaptemplate search always return attributes in string format.
How can i get hold of "objectGUID" in its format, so that i can store it and use in ldapTemplate search queries.
Thanks in advance.