-
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?
I don't answer coding questions via PM or Email. Please post a thread in the appropriate forum section.
Please use [Code]your code goes in here[/Code] tags when posting code.
Before posting your question, did you look here?
Got a question on Linux? Visit our Linux sister site.
Modifications Required For VB6 Apps To Work On Vista
Similar Threads
-
By mdengler in forum ASP.NET
Replies: 0
Last Post: 11-26-2002, 02: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, 08: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
|
Top DevX Stories
Easy Web Services with SQL Server 2005 HTTP Endpoints
JavaOne 2005: Java Platform Roadmap Focuses on Ease of Development, Sun Focuses on the "Free" in F.O.S.S.
Wed Yourself to UML with the Power of Associations
Microsoft to Add AJAX Capabilities to ASP.NET
IBM's Cloudscape Versus MySQL
|
Bookmarks