-
Set userPassword attribute in ADAM using LDAP+JNDI
I am trying to set the attribute "userPassword" for an Organization Unit (OU). I have used SHA algorithm for encrypting the password.For example ,the encrypted password that i got is "TmmQPaHwGiohpiziJUKVGXgZX9k="
I am storing this encrypted password to the attribute "userPassword".
I am getting the following error :
Problem resetting password: javax.naming.directory.NoSuchAttributeException: [LDAP: error code 16 - 00000057: LdapErr: DSID-0C090B3D, comment: Error in attribute conversion operation, data 0, va28
Here is the functtion that i used for setting the password.
"Encrypt" is the function that returns the encrypted value of the password string.
Can anyone help me on this issue? or if there is any other easy way to set the UserPassword attribute?
Code:
public boolean setPassword(String orgUnit,String Pass) throws NamingException, NoSuchAlgorithmException
{
try
{
String newUnicodePassword=encrypt(Pass);
ModificationItem[] mods = new ModificationItem[1];
mods[0] = new ModificationItem(DirContext.REPLACE_ATTRIBUTE, new BasicAttribute("userPassword", newUnicodePassword));
System.out.println(mods[0]);
ctx.bind("ou=wipro,dc=example,dc=com",mods);
System.out.println("Set password & updated userccountControl");
return true;
}
catch (NamingException e) {
System.out.println("Problem resetting password: " + e);
}
catch (UnsupportedEncodingException e) {
System.out.println("Problem encoding password: " + e);
}
return false;
}
-
Instead of resetting it can you flat out delete it and create a new one?
Similar Threads
-
By mdengler in forum ASP.NET
Replies: 0
Last Post: 11-26-2002, 03:32 PM
-
By YC Choo in forum Database
Replies: 5
Last Post: 09-03-2001, 01:42 PM
-
Replies: 2
Last Post: 06-14-2001, 12:19 PM
-
Replies: 4
Last Post: 04-13-2001, 03:31 AM
-
Replies: 1
Last Post: 12-23-2000, 09:42 AM
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Development Centers
-- Android Development Center
-- Cloud Development Project Center
-- HTML5 Development Center
-- Windows Mobile Development Center
|