Changing the user password
To change the user password, authenticate the old password and request to set a new password.
This operation is similar to a pkmspasswd of WebSEAL.
The following example shows the sample code for changing the oldpassword to newpassword for
a user testuser:
// Fetch the user
String userId = “testuser”;
RgyUser rgyUser = null;
try {
rgyUser = rgyRegistry.getUser(“Default”, userId);
}
catch (RgyException e) {
e.printStackTrace();
System.exit(1);
}
// Ensure the user was found
if (rgyUser == null) {
System.out.println(“Group does not exist”);
System.exit(1);
}
try {
rgyUser = rgyUser.changePassword(“oldpassword”.toCharArray(),
“newpassword”.toCharArray());
}
catch (RgyException e) {
e.printStackTrace();
System.exit(1);
}