Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

com.j256.two-factor-auth:two-factor-auth

Package Overview
Dependencies
Maintainers
1
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

com.j256.two-factor-auth:two-factor-auth

Two Factor Authentication (Auth) implementation for Java which uses the Time-based One-time Password (TOTP) algorithm.

  • 1.3
  • Source
  • Maven
  • Socket score

Version published
Maintainers
1
Source

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.

  • See the wikipedia page about TOTP.
  • Code available from the git repository. CircleCI CodeCov
  • Maven packages are published via Maven Central

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.

FAQs

Package last updated on 31 Dec 2020

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc