use of javax.xml.rpc.holders.IntHolder in project mobileid by codeborne.
the class MobileIDAuthenticatorTest method mockAuthentication.
private DigiDocServicePortType mockAuthentication(String result, String firstName, String lastName, String personalCode, String challenge, int sessCode) throws RemoteException {
DigiDocServicePortType service = mock(DigiDocServicePortType.class);
doAnswer((Answer<Object>) invocation -> {
((IntHolder) invocation.getArguments()[11]).value = sessCode;
((StringHolder) invocation.getArguments()[12]).value = result;
((StringHolder) invocation.getArguments()[13]).value = personalCode;
((StringHolder) invocation.getArguments()[14]).value = firstName;
((StringHolder) invocation.getArguments()[15]).value = lastName;
((StringHolder) invocation.getArguments()[19]).value = challenge;
return null;
}).when(service).mobileAuthenticate(anyString(), anyString(), anyString(), anyString(), anyString(), anyString(), anyString(), anyString(), anyInt(), anyBoolean(), anyBoolean(), any(IntHolder.class), any(StringHolder.class), any(StringHolder.class), any(StringHolder.class), any(StringHolder.class), any(StringHolder.class), any(StringHolder.class), any(StringHolder.class), any(StringHolder.class), any(StringHolder.class), any(StringHolder.class));
return service;
}
use of javax.xml.rpc.holders.IntHolder 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);
}
Aggregations