use of com.codeborne.security.AuthenticationException in project mobileid by codeborne.
the class MobileIDAuthenticator method startLogin.
protected MobileIDSession startLogin(String personalCode, String countryCode, String phone) {
if (service == null) {
throw new IllegalStateException("digidocServiceURL is not initialized");
}
if (phone != null) {
if (phone.startsWith("+"))
phone = phone.substring(1);
if (!phone.startsWith("372"))
phone = "372" + phone;
}
IntHolder sessCode = new IntHolder();
StringHolder result = new StringHolder();
StringHolder firstName = new StringHolder();
StringHolder lastName = new StringHolder();
StringHolder personalCodeHolder = new StringHolder();
StringHolder challenge = new StringHolder();
try {
service.mobileAuthenticate(personalCode, countryCode, phone, language, serviceName, loginMessage, generateSPChallenge(), messagingMode, 0, false, false, sessCode, result, personalCodeHolder, firstName, lastName, new StringHolder(), new StringHolder(), new StringHolder(), challenge, new StringHolder(), new StringHolder());
} catch (RemoteException e) {
throw new AuthenticationException(e);
}
if (!"OK".equals(result.value))
throw new AuthenticationException(valueOf(result.value));
return new MobileIDSession(sessCode.value, challenge.value, firstName.value, lastName.value, personalCodeHolder.value);
}
use of com.codeborne.security.AuthenticationException in project account-identity by cryptofiat.
the class MobileIdAuthService method fullLogin.
public MobileIDSession fullLogin(String phoneNumber) {
MobileIDSession mobileIDSession;
try {
mobileIDSession = startLogin(phoneNumber);
waitForLogin(mobileIDSession);
} catch (AuthenticationException e) {
e.printStackTrace();
log.info("Mobile ID authentication failed" + e.getMessage());
return null;
}
return mobileIDSession;
}
Aggregations