-
-
Notifications
You must be signed in to change notification settings - Fork 111
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
1 changed file
with
9 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -8,18 +8,25 @@ You can use this code with the Google Authenticator mobile app or the Authy mobi | |
* Browse the code on the [git repository](https://github.com/j256/two-factor-auth). [](https://circleci.com/gh/j256/two-factor-auth) | ||
* Maven packages are published via the [maven central repo](http://repo1.maven.org/maven2/com/j256/two-factor-auth/two-factor-auth/). | ||
|
||
To get this to work you: | ||
## 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: | ||
## 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 `generateCurrentNumberString(...)`. | ||
4. If they are equal then the user is allowed to log in. | ||
|
||
For more details, see the [example program](https://github.com/j256/two-factor-auth/blob/master/src/test/java/com/j256/twofactorauth/TwoFactorAuthExample.java). | ||
|
||
## Sample QR Image | ||
|
||
The following is a sample QR image generated by GoogleAPIs URL. It is the QR code for the base-32 encoded | ||
secret `"NY4A5CPJZ46LXZCP"`. See the [example program](https://github.com/j256/two-factor-auth/blob/master/src/test/java/com/j256/twofactorauth/TwoFactorAuthExample.java) for more details. | ||
|
||
 |