Jump to: navigation, search

Change Password On Next Login

An example of the usual Configuration Server connection open scenario is provided below:

ConfServerProtocol protocol = new ConfServerProtocol(new Endpoint("cfgsrv", csHost, csPort));
protocol.setClientName(clientAppName);
protocol.setClientApplicationType(clientAppType.ordinal());
protocol.setUserName(userName);
protocol.setUserPassword(userPasswd);
protocol.open();

When the user has enabled the Change Password on Next Login feature, protocol.open() throws ChangePasswordException.

So the resulting code may look like:

ConfServerProtocol protocol = new ConfServerProtocol(new Endpoint("cfgsrv", csHost, csPort));
protocol.setClientName(clientAppName);
protocol.setClientApplicationType(clientAppType.ordinal());
protocol.setUserName(userName);
protocol.setUserPassword(userPasswd);
try {
  protocol.open();
} catch (ChangePasswordException e) {
  String newPasswd = ...; // obtain new user password
  protocol.useChangePasswordRegistration(newPasswd);
  protocol.open();
}

After a successful open procedure, the new password value will be accepted, so protocol.getUserPassword() will be equal to newPasswd value specified.

This page was last modified on September 26, 2013, at 08:01.

Feedback

Comment on this article:

blog comments powered by Disqus