Mobile-ID (Mobiil-ID) is a personal mobile identity in Estonia and Lithuania, provided by an additional application on a SIM card. The good thing is that it is backed by government and provides the same level of security for authentication and digital signatures as a national ID card without the need of having a smart card reader.
Java and Mobile-ID
The official Mobile-ID API is a SOAP web service, so it usually takes time to generate the code and start using it in a Java application.
This small library tries to solve this problem: just add the mobileid.jar (with dependencies) to your project and you have a working Mobile-ID support. It already contains all the generated classes (by axis v1) as well as a simplified API of our own.
The same jar works in Scala as well or any other JVM-based language.
You can also use Maven/Ivy/Gradle/SBT or your favorite dependency manager that can fetch jars from the official Maven2 repo:
Just use the public methods in MobileIDAuthenticator class:
- startLogin(phoneNumber) - to initiate the login session, which will send a flash message to your mobile phone. The returned MobileIDSession contains the challenge code that you need to display to the user.
- waitForLogin(session) - to wait until user finally signs the challenge. This is a blocking call for simplicity.
- isLoginComplete(session) - if you want to do polling from the client side
See working example in HelloMobileID.java - run the main() method.
Many thanks to these incredible tools that help us creating open-source software:
mobile-id is open-source project and distributed under MIT license