Set userPassword attribute in ADAM using LDAP+JNDI


DevX Home    Today's Headlines   Articles Archive   Tip Bank   Forums   

Results 1 to 2 of 2

Thread: Set userPassword attribute in ADAM using LDAP+JNDI

  1. #1
    Join Date
    Jun 2007
    Posts
    2

    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;
    }

  2. #2
    Join Date
    Apr 2007
    Location
    Sterling Heights, Michigan
    Posts
    8,666
    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

  1. Input string was not in a correct format
    By mdengler in forum ASP.NET
    Replies: 0
    Last Post: 11-26-2002, 02:32 PM
  2. Create Procedure
    By YC Choo in forum Database
    Replies: 5
    Last Post: 09-03-2001, 01:42 PM
  3. Creating XML document using DOM
    By Gee in forum XML
    Replies: 2
    Last Post: 06-14-2001, 12:19 PM
  4. simple XML APPENDING problem
    By scopee in forum XML
    Replies: 4
    Last Post: 04-13-2001, 03:31 AM
  5. 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
  •  
HTML5 Development Center
 
 
FAQ
Latest Articles
Java
.NET
XML
Database
Enterprise
Questions? Contact us.
C++
Web Development
Wireless
Latest Tips
Open Source


   Development Centers

   -- Android Development Center
   -- Cloud Development Project Center
   -- HTML5 Development Center
   -- Windows Mobile Development Center