Exemplo de recuperação de tentativas de login inválido de um usuário.
package doxy.examples;
import java.util.concurrent.TimeUnit;
import com.dinamonetworks.Dinamo;
import br.com.trueaccess.TacException;
import br.com.trueaccess.TacNDJavaLib;
public class InvalidLoginAttempts {
public static void main(String[] args) throws TacException, InterruptedException {
Dinamo opUserSession = new Dinamo();
String hsmIP = "127.0.0.1";
String operatorId = "master";
String operatorPwd = "12345678";
String userId = "user01";
String userPwd = "12345678";
int authMask = 0;
opUserSession.openSession(hsmIP, operatorId, operatorPwd, TacNDJavaLib.DEFAULT_PORT, false, false, true);
opUserSession.createUser(userId, userPwd, authMask);
System.out.println("User " + userId + " invalid login attempts: " +
opUserSession.getUserInvalidLoginAttempts(userId));
Dinamo userSession = new Dinamo();
try {
userSession.openSession(hsmIP,
userId,
"invalidpwd",
TacNDJavaLib.DEFAULT_PORT,
false,
false,
true);
}catch(TacException e)
{
}
System.out.println("User " + userId + " invalid login attempts: " +
opUserSession.getUserInvalidLoginAttempts(userId));
userSession.openSession(hsmIP,
userId,
userPwd,
TacNDJavaLib.DEFAULT_PORT,
false,
false,
true);
System.out.println("User " + userId + " invalid login attempts: " +
opUserSession.getUserInvalidLoginAttempts(userId));
userSession.closeSession(true);
TimeUnit.SECONDS.sleep(1);
opUserSession.deleteUser(userId);
opUserSession.closeSession();
}
}