Skip to content

travisspencer/aerogear-otp-java

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

aerogear-otp-java - Java One Time Password API

A Java library for generating one time passwords according to RFC 4226..

This API is compatible with Google Authenticator apps available for Android and iPhone. You can follow the instructions here to install Google Authenticator.

how to create a new project

basic use case

  1. add the maven dependency

     <dependency>
         <groupId>org.jboss.aerogear</groupId>
         <artifactId>aerogear-otp-java</artifactId>
         <version>1.0.0</version>
         <scope>compile</scope>
     </dependency>
    

Getting started

Use

  1. Time based OTP's

     String secret = Base32.random();
     Totp totp = new Totp(secret);
     totp.now(); //427773
     
     totp.verify("427773"); //true
     Thread.sleep(40);
     totp.verify("427773"); //false
    

Working example

  1. Go to http://controller-aerogear.rhcloud.com/aerogear-controller-demo/login
  2. Login with username: john and password: 123. Click on Give it a try.
  3. Now open google authenticator application at your phone
  4. Go to Add account
  5. Then ask to Scan barcode
  6. After that john account might be added
  7. On your web browser go to Try Google authenticator
  8. Enter username: john and password: 123 and use the current OTP on your mobile

For more details, please refer to our documentation

Are you feeling brave? Try from the snapshot releases!

 <dependency>
     <groupId>org.jboss.aerogear</groupId>
     <artifactId>aerogear-security</artifactId>
     <version>1.0.1-SNAPSHOT</version>
     <scope>compile</scope>
 </dependency>

About

No description, website, or topics provided.

Resources

License

Stars

Watchers

Forks

Packages

No packages published