Add Freja eID Client to your build


To add dependency on Freja eID Client using Maven, use the following command:

<dependency>
    <groupId>com.verisec.frejaeid</groupId>
    <artifactId>FrejaEidClient</artifactId>
    <version>2.13.1</version>
</dependency>


Initiate connection to API (test environment)

SslSettings sslSettings = SslSettings
    .create("/path/to/keystore.jks", "SuperSecretKeystorePassword",
            "/path/to/server/certificate.crt");


Initiate, monitor and cancel authentication request


Create an authentication client.

AuthenticationClientApi authenticationClient = AuthenticationClient
    .create(sslSettings, FrejaEnvironment.TEST)
    .build();

Initiate an authentication request.

InitiateAuthenticationRequest request = InitiateAuthenticationRequest
    .createDefaultWithEmail("[email protected]");
String reference = authenticationClient.initiate(request);

Poll for results of your request.

int maxWaitingTimeInSeconds = 120;
AuthenticationResult result = authenticationClient
    .pollForResult(AuthenticationResultRequest
    .create(reference), maxWaitingTimeInSeconds);

Cancel the initiated request.

authenticationClient.cancel(CancelAuthenticationRequest
    .create(reference));


Initiate, monitor and cancel signature request


Create a signature client.

SignClientApi signClient = SignClient
    .create(sslSettings, FrejaEnvironment.TEST)
    .build();

Initiate a signature request.

InitiateSignRequest request = InitiateSignRequest
    .createDefaultWithEmail("[email protected]", "Title", 
        "Text to be signed");
String reference = signClient.initiate(request);

Poll for results of your request.

int maxWaitingTimeInSeconds = 180;
SignResult result = signClient
    .pollForResult(SignResultRequest
    .create(reference), maxWaitingTimeInSeconds);

Cancel the initiated request.