Freja eID Client is a client library aimed to ease integration of relying party back-end systems with Freja eID Relying Party API.
This client library provides a set of classes, interfaces and utility methods designed for accomplishing one of the following use cases:
-
Authentication Services API Client
- initiation of an authentication request
- fetching a single authentication result based on authentication reference
- fetching multiple authentication results
- cancelling authentication request
-
Signature Services API Client
- initiation of a signature request
- fetching a single signature result based on signature reference
- fetching multiple signature results
- cancelling signature request
-
Custom Identifier Management API Client
- setting a custom identifier for a user
- deleting a custom identifier
-
Organisation ID Management API Client
- adding an organisation identifier for a user
- deleting an organisation identifier for a user
- fetching result of adding an organisation identifier for a user
- cancelling adding organisation identifier for a user
- updating additional attributes for an issued organisation ID
-
Integrator Relying Party Management API Client
- using all available services as an Integrator Relying Party
To add a dependency on Freja eID Client using Maven, use the following:
<dependency>
<groupId>com.verisec.frejaeid</groupId>
<artifactId>FrejaEidClient</artifactId>
<version>2.25.0</version>
</dependency>
You can find an up-to-date and complete documentation on how to use the library at Freja eID Library Wiki.
SslSettings sslSettings = SslSettings.create("/path/to/keystore.jks", "SuperSecretKeystorePassword", "/path/to/server/certificate.crt");
Create authentication client
AuthenticationClientApi authenticationClient = AuthenticationClient.create(sslSettings, FrejaEnvironment.TEST).build();
Initiate request
InitiateAuthenticationRequest request = InitiateAuthenticationRequest.createDefaultWithEmail("email@example.com");
String reference = authenticationClient.initiate(request);
Poll for result
int maxWaitingTimeInSeconds = 120;
AuthenticationResult result = authenticationClient.pollForResult(AuthenticationResultRequest.create(reference), maxWaitingTimeInSeconds);
Cancel request
authenticationClient.cancel(CancelAuthenticationRequest.create(reference));
Create sign client
SignClientApi signClient = SignClient.create(sslSettings, FrejaEnvironment.TEST).build();
Initiate request
InitiateSignRequest request = InitiateSignRequest.createDefaultWithEmail("email@example.com", "Title", "Text to be signed");
String reference = signClient.initiate(request);
Poll for result
int maxWaitingTimeInSeconds = 180;
SignResult result = signClient.pollForResult(SignResultRequest.create(reference), maxWaitingTimeInSeconds);
Cancel request
signClient.cancel(CancelSignRequest.create(reference));