use of org.openecard.mdlw.sal.exceptions.AuthenticationException in project open-ecard by ecsec.
the class PinChangeStepAction method perform.
@Override
public StepActionResult perform(Map<String, ExecutionResults> oldResults, StepResult result) {
try {
if (pinStep.isCapturePuk()) {
if (pinStep.isProtectedAuthPath()) {
pinStep.getSession().loginExternal(UserType.Security_Officer);
pinStep.getSession().initPinExternal();
} else {
char[] puk = getPuk();
pinStep.getSession().login(UserType.Security_Officer, puk);
char[] newPin = getNewPin();
pinStep.getSession().initPin(newPin);
}
} else {
if (pinStep.isProtectedAuthPath()) {
// pinStep.getSession().loginExternal(UserType.User);
pinStep.getSession().changePinExternal();
} else {
char[] oldPin = getOldPin();
char[] newPin = getNewPin();
pinStep.getSession().changePin(oldPin, newPin);
}
}
pinStep.setPinChangeSuccessful();
pinStep.updateState();
return new StepActionResult(StepActionResultStatus.REPEAT);
} catch (PinIncorrectException ex) {
if (LOG.isDebugEnabled()) {
LOG.debug("PIN incorrect.", ex);
} else {
LOG.info("PIN incorrect.");
}
pinStep.setLastTryFailed();
try {
pinStep.updateState();
return new StepActionResult(StepActionResultStatus.REPEAT);
} catch (CryptokiException ex1) {
// I suspect user removed card
return new StepActionResult(StepActionResultStatus.CANCEL);
}
} catch (PinsDoNotMatchException ex) {
LOG.debug("Mismatching PINs entered.", ex);
try {
pinStep.setPinsDoNotMatch();
pinStep.updateState();
return new StepActionResult(StepActionResultStatus.REPEAT);
} catch (CryptokiException ex2) {
// I suspect user removed card
return new StepActionResult(StepActionResultStatus.CANCEL);
}
} catch (PinBlockedException ex) {
// let the UI take care of producing a blocked error
try {
pinStep.updateState();
return new StepActionResult(StepActionResultStatus.REPEAT);
} catch (CryptokiException ex2) {
// I suspect user removed card
return new StepActionResult(StepActionResultStatus.CANCEL);
}
} catch (AuthenticationException ex) {
LOG.error("Authentication error while entering the PIN.", ex);
try {
pinStep.setUnkownError();
pinStep.updateState();
return new StepActionResult(StepActionResultStatus.REPEAT);
} catch (CryptokiException ex2) {
// I suspect user removed card
return new StepActionResult(StepActionResultStatus.CANCEL);
}
} catch (CryptokiException ex) {
LOG.error("Unknown error while entering the PIN.", ex);
try {
pinStep.setUnkownError();
pinStep.updateState();
return new StepActionResult(StepActionResultStatus.REPEAT);
} catch (CryptokiException ex2) {
// I suspect user removed card
return new StepActionResult(StepActionResultStatus.CANCEL);
}
}
}
use of org.openecard.mdlw.sal.exceptions.AuthenticationException in project open-ecard by ecsec.
the class PinEntryStepAction method perform.
@Override
public StepActionResult perform(Map<String, ExecutionResults> oldResults, StepResult result) {
try {
if (pinStep.isProtectedAuthPath()) {
pinStep.getSession().loginExternal(UserType.User);
} else {
char[] pPin = getPin();
pinStep.getSession().login(UserType.User, pPin);
}
pinStep.setPinAuthenticated();
return new StepActionResult(StepActionResultStatus.NEXT);
} catch (PinIncorrectException ex) {
if (LOG.isDebugEnabled()) {
LOG.debug("PIN incorrect.", ex);
} else {
LOG.info("PIN incorrect.");
}
pinStep.setLastTryFailed();
try {
pinStep.updateState();
return new StepActionResult(StepActionResultStatus.REPEAT);
} catch (CryptokiException ex1) {
// I suspect user removed card
return new StepActionResult(StepActionResultStatus.CANCEL);
}
} catch (PinBlockedException ex) {
// let the UI take care of producing a blocked error
try {
pinStep.setPinBlocked();
pinStep.updateState();
return new StepActionResult(StepActionResultStatus.REPEAT);
} catch (CryptokiException ex2) {
// I suspect user removed card
return new StepActionResult(StepActionResultStatus.CANCEL);
}
} catch (AuthenticationException ex) {
LOG.error("Authentication error while entering the PIN.", ex);
pinStep.setLastTryFailed();
pinStep.setUnkownError();
try {
pinStep.updateState();
return new StepActionResult(StepActionResultStatus.REPEAT);
} catch (CryptokiException ex1) {
// I suspect user removed card
return new StepActionResult(StepActionResultStatus.CANCEL);
}
} catch (CryptokiException ex) {
LOG.error("Unkonw error while entering the PIN.", ex);
pinStep.setLastTryFailed();
pinStep.setUnkownError();
try {
pinStep.updateState();
return new StepActionResult(StepActionResultStatus.REPEAT);
} catch (CryptokiException ex1) {
// I suspect user removed card
return new StepActionResult(StepActionResultStatus.CANCEL);
}
}
}
Aggregations