We provide an implementation of AuthenticationProvider which uses the one time passwords
to perform authentication.
The module supports the Google Authenticator, you can choose any convenient library for creating the QR code with key, or simply transfer key in the format base32.
To use this project, add the following dependency to the dependencies section of your build descriptor:
-
Maven (in your
pom.xml):
<dependency>
<groupId>io.vertx</groupId>
<artifactId>vertx-auth-otp</artifactId>
<version>4.2.4</version>
</dependency>
-
Gradle (in your
build.gradlefile):
compile 'io.vertx:vertx-auth-otp:4.2.4'
HOTP Authentication
To create an instance of the Hotp auth provider, use HotpAuth.create as follows:
HOTP Configuration
The class HotpAuthOptions is used to configure the Hotp authentication provider:
passwordLength-
the set otp code length, valid value between 6 and 8, default value equal 6.
authAttemptsLimit-
the limit auth attempts.
lookAheadWindow-
the resynchronization mechanism usage.
Notes
Note that when authenticating using this implementation, it assumes identifier, key and counter fields are present in the authentication info
TOTP Authentication
To create an instance of the Totp auth provider, use TotpAuth.create as follows
TOTP Configuration
The class TotpAuthOptions is used to configure the Totp authentication provider:
passwordLength-
the set otp code length, valid value between 6 and 8, default value equal 6.
authAttemptsLimit-
the limit auth attempts.
period-
time period in seconds during which the authentication code is valid, default value equal 30.
Notes
Note that when authenticating using this implementation, it assumes identifier, key fields are present in the authentication info