Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations IamaSherpa on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

CHANGE PASSOWRD - LDAP

Status
Not open for further replies.

peterbrews

Programmer
Jun 26, 2002
1
US
I am new to ldap .I need to write a method to be able to change password when the user request for it .What do i need to get this work done.I have no information about the ldap server which is on remote server of my client.

Currently i am using following code for authentication .


public String login(String userid, String password) {

StringBuffer result = new StringBuffer();
StringBuffer sb = new StringBuffer();

sb.append("uid=");
sb.append(userid);
sb.append(",ou=zeesoftusers,");
sb.append("dc=zeesoft,");
sb.append("c=com");
String loginstr = sb.toString();

// Set-up Environment
Hashtable environment = new Hashtable();
environment.put(Context.INITIAL_CONTEXT_FACTORY,
"com.sun.jndi.ldap.LdapCtxFactory");
environment.put(Context.PROVIDER_URL, "ldap://remotehostname:port");
environment.put(Context.SECURITY_PRINCIPAL,loginstr);
environment.put(Context.SECURITY_CREDENTIALS, password);
environment.put(Context.SECURITY_AUTHENTICATION, "simple");
try {
InitialDirContext root = new InitialDirContext(environment);
root.close();
result.append("SUCCESS");
} catch (NamingException ex) {
result.append("ERROR : " + ex);
logger.error(result.toString());
}

return result.toString();
}

any help is highly apprecaited.

thanks in advance
pete

 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top