Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
HomeAnnouncementsWhite Papers
Discussion GroupsFirst AidDatabasesJavaBeansGUIJava 3DVirtual MachineCORBASecurityToolsGeneral
Java DirectoryOpen Source ProjectsSample Book ChaptersUser GroupsWeb Resources
Related Topics
Databases.NETMore Topics ...

Java Forum / General / March 2007

Tip: Looking for answers? Try searching our database.

Password retrieval app

Thread view: 
al.softdev@gmail.com - 30 Mar 2007 20:50 GMT
Hello,

I would like to create an online app where if the user (has account on
AD) has forgotten the password, can reset the password and that will
send a link to their email address to reset this temporary password.
This is almost similar to the password reset emails that we receive
from most of the online sites now.

Can someone guide me where I need to start? Anywhere from links to
ideas would be helpful
Brandon McCombs - 31 Mar 2007 07:04 GMT
> Hello,
>
[quoted text clipped - 6 lines]
> Can someone guide me where I need to start? Anywhere from links to
> ideas would be helpful

You need to use JNDI to access the ADS LDAP database, however
setting/resetting a password in ADS is only allowed through a SSL
connection. That is just something that it enforces so you can't get
around it (at least in this case they have high security).

Here is some of the code I use to do the password preparation and actual
modification work:

public byte[] processPassword(String pass) {
    String newQuotedPassword = "\"" + pass + "\"";
    try {
        return newQuotedPassword.getBytes("UTF-16LE");
    } catch (UnsupportedEncodingException Ex) {
        LDAPMgr.mesgBar.setText(" Error encoding
        password to unicode: "     + Ex.getMessage(),            
        AlertStatus.ERROR);
        return null;
    }
}
   
public void setPassword(String dn, String pass) throws Exception {
    ModificationItem[] mods = new ModificationItem[1];
    byte[] newUnicodePassword = processPassword(pass);
    mods[0] = new ModificationItem(DirContext.REPLACE_ATTRIBUTE,
        new BasicAttribute("unicodePwd", newUnicodePassword));
    ctx.modifyAttributes(new LdapName(dn), mods);
}

You will need to setup your InitialLdapContext object by authenticating
as some type of administrative user which will be used to set the user's
password on the user's behalf (an SSL cert. must be created for that
user so the SSL handshake can be made).

If you need further help let me know. I've created an LDAP application
that allows various operations to be performed to ADS as well as other
directory servers so I know the pitfalls you may run into.


Free Magazines

Get these publications absolutely FREE for up to 12 months. There are no hidden fees and no obligation. Simply choose a title, complete the application form and submit it. Read more ...

Oracle MagazineNetwork ComputingComputer WorldBio-IT WorldeWeekInformation WeekInfosecurity
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.