Reputation: 6523
i want to get userPassword attribute from ldap using spring in java.
of course this not work:
context.getStringAttribute("userPassword");
If i try:
context.getObjectAttribute("userPassword");
i can get this attribute..but now from Object how i can get the hash password?
Upvotes: 3
Views: 7054
Reputation: 2485
It sounds like context.getObjectAttribute("userPassword")
returns an Object
so you just need to identify what it is.
Based on the comments it was a byte[]
array which was representing a String
, so you can basically do this:
Object o = context.getObjectAttribute("userPassword");
byte[] bytes = (byte[]) o;
String hash = new String(bytes);
Upvotes: 5