totp-authenticator-spring-boot

a spring boot starter for TOTP Authenticator

License

License

Categories

Categories

Spring Boot Container Microservices
GroupId

GroupId

com.github.cheergoivan
ArtifactId

ArtifactId

totp-authenticator-spring-boot
Last Version

Last Version

1.0
Release Date

Release Date

Type

Type

pom
Description

Description

totp-authenticator-spring-boot
a spring boot starter for TOTP Authenticator
Project URL

Project URL

https://github.com/cheergoivan/totp-authenticator-spring-boot-starter
Source Code Management

Source Code Management

https://github.com/cheergoivan/totp-authenticator-spring-boot-starter

Download totp-authenticator-spring-boot

How to add to project

<!-- https://jarcasting.com/artifacts/com.github.cheergoivan/totp-authenticator-spring-boot/ -->
<dependency>
    <groupId>com.github.cheergoivan</groupId>
    <artifactId>totp-authenticator-spring-boot</artifactId>
    <version>1.0</version>
    <type>pom</type>
</dependency>
// https://jarcasting.com/artifacts/com.github.cheergoivan/totp-authenticator-spring-boot/
implementation 'com.github.cheergoivan:totp-authenticator-spring-boot:1.0'
// https://jarcasting.com/artifacts/com.github.cheergoivan/totp-authenticator-spring-boot/
implementation ("com.github.cheergoivan:totp-authenticator-spring-boot:1.0")
'com.github.cheergoivan:totp-authenticator-spring-boot:pom:1.0'
<dependency org="com.github.cheergoivan" name="totp-authenticator-spring-boot" rev="1.0">
  <artifact name="totp-authenticator-spring-boot" type="pom" />
</dependency>
@Grapes(
@Grab(group='com.github.cheergoivan', module='totp-authenticator-spring-boot', version='1.0')
)
libraryDependencies += "com.github.cheergoivan" % "totp-authenticator-spring-boot" % "1.0"
[com.github.cheergoivan/totp-authenticator-spring-boot "1.0"]

Dependencies

There are no dependencies for this project. It is a standalone project that does not depend on any other jars.

Project Modules

  • totp-authenticator-spring-boot-autoconfigure
  • totp-authenticator-spring-boot-starter

Spring Boot Starter for TOTP Authenticator

This is a spring boot starter for TOTP Authenticator.

Quick start

Add Maven dependency

<dependency>
    <groupId>com.github.cheergoivan</groupId>
    <artifactId>totp-authenticator-spring-boot-starter</artifactId>
    <version>1.0</version>
</dependency>

Usage

import org.junit.Test;
import org.junit.runner.RunWith;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.test.context.SpringBootTest;
import org.springframework.test.context.junit4.SpringRunner;

import com.github.cheergoivan.totp.TOTPAuthenticator;

@RunWith(SpringRunner.class)
@SpringBootTest
public class TOTPAuthenticatorTest {
	
	@Autowired
	private TOTPAuthenticator totpAuthenticator;

	@Test
	public void contextLoads() {
		String secret = "ASDFGFHJKL";
		String totp = totpAuthenticator.generateTOTP(secret);
		System.out.println(totp);
		System.out.println(totpAuthenticator.validateTOTP(secret, totp));
	}
}

Configuration

Here are all supported configurations and their default values in TOTPAuthenticator.

iplay.totp.length=6
iplay.totp.time-step-size=30
iplay.totp.hash-algorithm=SHA_1
iplay.totp.allowed-past-validation-windows=2
iplay.totp.allowed-future-validation-windows=0
iplay.totp.decoder=com.github.cheergoivan.totp.decoder.SHA1Decoder

License

This project is licensed under the Apache 2 License.

Versions

Version
1.0