• Stars
    star
    313
  • Rank 133,714 (Top 3 %)
  • Language
    Java
  • License
    ISC License
  • Created over 9 years ago
  • Updated almost 2 years ago

Reviews

There are no reviews yet. Be the first to send feedback to the community and the maintainers!

Repository Details

Two Factor Authentication Java code implementing the Time-based One-time Password Algorithm

Two (2) Factor Authentication (2FA) Java Code

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

To get this to work you:

  1. Use generateBase32Secret() to generate a secret key in base-32 format for the user. For example: "NY4A5CPJZ46LXZCP"
  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. Here's a sample which uses GoogleAPIs:
    Sample QR Image
  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 on the web server.
  2. The web server reads 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.

Maven Configuration

<dependencies>
	<dependency>
		<groupId>com.j256.two-factor-auth</groupId>
		<artifactId>two-factor-auth</artifactId>
		<version>1.3</version>
	</dependency>
</dependencies>

ChangeLog Release Notes

See the ChangeLog.txt file.

More Repositories

1

ormlite-android

ORMLite Android functionality used in conjunction with ormlite-core
Java
1,588
star
2

ormlite-core

Core ORMLite functionality that provides a lite Java ORM in conjunction with ormlite-jdbc or ormlite-android
Java
577
star
3

ormlite-jdbc

ORMLite JDBC functionality that works with JDBC drivers to attach to various database types
Java
224
star
4

simplemagic

Simple file magic number and content-type library which provides mime-type determination from files and byte arrays
Java
218
star
5

ormlite-examples

Various example programs
Java
181
star
6

dmalloc

Debug Malloc memory allocation debugging C library
C
159
star
7

simplejmx

Simple JMX Java Library to help with the publishing of objects using JMX and the web
Java
92
star
8

cloudwatch-logback-appender

Appender that publishes logback log entries to AWS CloudWatch
Java
55
star
9

simplecsv

Simple Java CSV reading and writing library using Java annotations
Java
24
star
10

perl-two-factor-auth

Two Factor Authentication Perl code
Perl
13
star
11

ormlite-tests

More extensive unit tests
Java
6
star
12

simplelogging

Simple Java logging facade which can backend into a number of different logging implementations and is designed to be copied into another project.
Java
5
star
13

simplezip

Java processing of Zip files that gives full control over all Zip disk structures
Java
5
star
14

simplemetrics

Simple Java metrics for counting and publishing metrics from Java applications
Java
3
star
15

test-check-publisher-maven-plugin

Maven plugin designed to take tests results produced by continuous integration systems and publish them to github as a "check" annotation on a particular commit.
Java
2
star
16

simple-web-framework

Simple web framework for providing annotation based web request handling
Java
2
star
17

ormlite-android-tests

Android specific tests for the emulator.
Java
2
star
18

mailgw

Mailgw Issues and Feature Requests
1
star
19

sortu

Unit sort command-line utility with the ability to count unique entries inline. Also includes some cut features to handle fields.
C
1
star
20

null

Unix command line utility which combines /dev/null, tree, md5sum, and other useful features.
C
1
star