Example of creating a new user, changing the password and removing the user.
package doxy.examples;
import com.dinamonetworks.Dinamo;
import br.com.trueaccess.TacException;
public class ChangePassword {
static String ipHSM = "127.0.0.1";
static String usr_admin = "master";
static String password_admin = "12345678";
static String usr_login = "usrapi01";
static String password_usr = "12345678";
static String new_password = "87654321";
public static void main(String[] args) throws TacException {
Dinamo api = new Dinamo();
System.out.println("--> Operator login and create a new user");
api.openSession(ipHSM, usr_admin, password_admin);
api.createUser(usr_login, password_usr, 0);
api.closeSession();
System.out.println("--> Login with the user created and change his password. It's not possible to operator change an user's password.");
api.openSession(ipHSM, usr_login, password_usr);
api.changePassword(new_password);
api.closeSession(true);
System.out.println("--> Login with the user created");
api.openSession(ipHSM, usr_login, new_password);
api.closeSession(true);
System.out.println("--> Remove the user");
api.openSession(ipHSM, usr_admin, password_admin);
api.deleteUser(usr_login);
api.closeSession();
System.out.println("The process ended sucessfully");
}
}