Skip to content

oneSIX/java-totp

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

31 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

2 Factor Authentication (2FA) Java code which used the Time-based One-time Password Algorithm (TOTP) algorithm. You can use this code with the Google Authenticator mobile app or the Authy mobile or browser app.

See: http://en.wikipedia.org/wiki/Time-based_One-time_Password_Algorithm

To get this to work you:

  1. Use generateBase32Secret() to generate a secret key for a user.
  2. Store the secret key in the database associated with the user account.
  3. Display the QR image URL returned by qrImageUrl(...) to the user.
  4. User uses the image to load the secret key into his authenticator application.

Whenever the user logs in:

  1. The user enters the number from the authenticator application into the login form.
  2. Read the secret associated with the user account from the database.
  3. The server compares the user input with the output from generateCurrentNumber(...).
  4. If they are equal then the user is allowed to log in.

For more details, see the example program.

About

Two Factor Authentication Java code

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • Java 100.0%