use of es.gob.jmulticard.card.dnie.CustomAuthorizeCallback in project jmulticard by ctt-gob-es.
the class DnieCallbackHandler method handle.
@Override
public void handle(final Callback[] callbacks) throws UnsupportedCallbackException {
if (callbacks != null) {
for (final Callback cb : callbacks) {
if (cb != null) {
if (cb instanceof CustomTextInputCallback) {
final UIPasswordCallbackCan uip = new UIPasswordCallbackCan(// $NON-NLS-1$
Messages.getString("CanPasswordCallback.0"), null, // $NON-NLS-1$
Messages.getString("CanPasswordCallback.0"), // $NON-NLS-1$
Messages.getString("CanPasswordCallback.2"));
((CustomTextInputCallback) cb).setText(new String(uip.getPassword()));
return;
} else if (cb instanceof CustomAuthorizeCallback) {
DialogBuilder.showSignatureConfirmDialog((CustomAuthorizeCallback) cb);
return;
} else if (cb instanceof PasswordCallback) {
final CommonPasswordCallback uip = new CommonPasswordCallback(((PasswordCallback) cb).getPrompt(), // $NON-NLS-1$
Messages.getString("CommonPasswordCallback.1"), true);
((PasswordCallback) cb).setPassword(uip.getPassword());
return;
} else {
// $NON-NLS-1$
LOGGER.severe("Callback no soportada: " + cb.getClass().getName());
}
}
}
} else {
// $NON-NLS-1$
LOGGER.warning("Se ha recibido un array de Callbacks nulo");
}
throw new UnsupportedCallbackException(null);
}
use of es.gob.jmulticard.card.dnie.CustomAuthorizeCallback in project jmulticard by ctt-gob-es.
the class DnieNFCCallbackHandler method handle.
@Override
public void handle(final Callback[] callbacks) throws UnsupportedCallbackException {
if (callbacks != null) {
for (final Callback cb : callbacks) {
if (cb instanceof PasswordCallback) {
final PinDialog dialog = new PinDialog(false, this.activity, cb, this.dialogDone);
final FragmentTransaction ft = ((FragmentActivity) this.activity).getSupportFragmentManager().beginTransaction();
final ShowPinDialogTask spdt = new ShowPinDialogTask(dialog, ft, this.activity, this.dialogDone);
final String input = spdt.getInput();
((PasswordCallback) cb).setPassword(input.toCharArray());
return;
}
String input;
if (cb instanceof CustomTextInputCallback) {
if (this.passwordCallback == null) {
final PinDialog dialog = new PinDialog(true, this.activity, cb, this.dialogDone);
final FragmentTransaction ft = ((FragmentActivity) this.activity).getSupportFragmentManager().beginTransaction();
final ShowPinDialogTask spdt = new ShowPinDialogTask(dialog, ft, this.activity, this.dialogDone);
input = spdt.getInput();
} else {
input = new String(this.passwordCallback.getPassword());
// En caso de fallar el primer CAN lo pedira de nuevo al ususario
this.passwordCallback = null;
}
((CustomTextInputCallback) cb).setText(input);
return;
}
if (cb instanceof CustomAuthorizeCallback) {
return;
}
LOGGER.severe(cb.getClass().getName());
}
} else {
// $NON-NLS-1$
LOGGER.warning("Se ha recibido un array de Callbacks nulo");
throw new UnsupportedCallbackException(null);
}
}
Aggregations