ChangePassword.java
Exemplo de criação de um novo usuário, troca da senha e remoção do usuário.
- Veja Nota sobre os exemplos.
public class ChangePassword {
static String ipHSM = "10.0.62.16";
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); // hard session liberate
System.out.println("--> Login with the user created");
api.openSession(ipHSM, usr_login, new_password);
api.closeSession(true); // hard session liberate
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");
}
}