描述
- 该存储库包含一个带有随附的演示服务器的Java库以及一个 JAAS模块,用于验证YubiKey OTP(一次性密码)。
- 默认情况下,该库使用Yubico YubiCloud验证平台,但可以将其配置为其他验证服务器。
用法
POM
<dependency>
<groupId>com.yubico</groupId>
<artifactId>yubico-validation-client2</artifactId>
<version>3.0.5</version>
</dependency>
JAVA
- 初始化 ```java // clientId and secretKey are retrieved from https://upgrade.yubico.com/getapikey YubicoClient client = YubicoClient.getClient(clientId, secretKey);
// otp is the OTP from the YubiKey VerificationResponse response = client.verify(otp); assert response.isOk();
- 检查
```java
YubicoClient.getPublicId(otp)
.equals(/* Yubikey ID associated with the user */);
记录
<dependency>
<groupId>org.slf4j</groupId>
<artifactId>slf4j-log4j</artifactId>
<version>1.6.1</version>
</dependency>