Search in sources :

Example 1 with AuthenticationException

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);
}
Also used : StringHolder(javax.xml.rpc.holders.StringHolder) AuthenticationException(com.codeborne.security.AuthenticationException) IntHolder(javax.xml.rpc.holders.IntHolder) RemoteException(java.rmi.RemoteException)

Example 2 with AuthenticationException

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;
}
Also used : AuthenticationException(com.codeborne.security.AuthenticationException) MobileIDSession(com.codeborne.security.mobileid.MobileIDSession)

Aggregations

AuthenticationException (com.codeborne.security.AuthenticationException)2 MobileIDSession (com.codeborne.security.mobileid.MobileIDSession)1 RemoteException (java.rmi.RemoteException)1 IntHolder (javax.xml.rpc.holders.IntHolder)1 StringHolder (javax.xml.rpc.holders.StringHolder)1