How to engage Touch ID authentication on MacOS with Java

376 Views Asked by At

After some Googling around, I am seeing all kinds of solutions and discussion about using Touch ID fingerprint authentication for Swift, Cocoa, Objective-C, etc. and also plenty of discussion on implementing biometric authentication on ios devices, but I'm not finding anything that explains how to authenticate a user with Touch ID inside a Java app on macOS (laptop, iMac, MacPro, etc.)

Does anyone know if there are any Java libraries out there for interacting with the user's touch id on their Apple computer? I would assume that there might be a need to validate a touchID with the keyChain, but you know what they say about assumptions... ;-)

Ultimately, I would like to be able to give users the option of using their touch ID instead of typing in a password to unlock the app or log into it.

1

There are 1 best solutions below

0
Alex Suzuki On

It's pretty straight-forward to access Touch ID and keychain form Java using JNI or JNA. Touch ID authentication can usually be added by just interfacing with two methods (1) is Touch ID enabled? 2) Authenticate with TouchID).

I wrote a relatively detailed article about this topic, and it also includes sample code which you are free to use.

https://blog.classycode.com/using-touch-id-from-java-de1ac060b19b