public interface IGoogleAuthenticator
| 限定符和类型 | 方法和说明 |
|---|---|
boolean |
authorize(String secret,
int verificationCode)
使用当前时间对照密钥检查验证码
|
boolean |
authorize(String secret,
int verificationCode,
long time)
使用指定的时间对照密钥检查验证码。
|
boolean |
authorizeUser(String userName,
int verificationCode)
此方法验证指定用户的验证码,该用户的私钥是使用当前时间从配置的凭据存储库中检索到的。
|
boolean |
authorizeUser(String userName,
int verificationCode,
long time)
此方法验证指定用户的验证代码,该用户的私钥是从配置的凭据存储库中检索到的。
|
GoogleAuthenticatorKey |
createCredentials()
此方法生成一组新的凭证,包括:
密钥
验证代码
临时代码列表
The user must register this secret on their device.
|
GoogleAuthenticatorKey |
createCredentials(String userName)
此方法生成一组新的凭据,调用
#createCredentials method with no arguments. |
ICredentialRepository |
getCredentialRepository()
This method returns the credential repository used by this instance, or
null if none is set or none can be found using the ServiceLoader
API. |
int |
getTotpPassword(String secret)
此方法生成当前的TOTP密码。
|
int |
getTotpPassword(String secret,
long time)
此方法在指定时间生成TOTP密码。
|
int |
getTotpPasswordOfUser(String userName)
此方法生成当前的TOTP密码。
|
int |
getTotpPasswordOfUser(String userName,
long time)
此方法在指定时间生成TOTP密码
|
void |
setCredentialRepository(ICredentialRepository repository)
This method sets the credential repository used by this instance.
|
GoogleAuthenticatorKey createCredentials()
The user must register this secret on their device.
GoogleAuthenticatorKey createCredentials(String userName)
#createCredentials method with no arguments. The generated
credentials are then saved using the configured
#ICredentialRepository service.
用户必须在他们的设备上注册这个服务。
userName - the user name.int getTotpPassword(String secret)
secret - the encoded secret key.int getTotpPassword(String secret, long time)
secret - The encoded secret key.time - The time to use to calculate the password.int getTotpPasswordOfUser(String userName)
userName - The user whose password must be created.int getTotpPasswordOfUser(String userName, long time)
userName - The user whose password must be created.time - The time to use to calculate the password.boolean authorize(String secret, int verificationCode)
secret - the encoded secret key.verificationCode - the verification code.true if the validation code is valid,
false otherwise.GoogleAuthenticatorException - if a failure occurs during the
calculation of the validation code.
The only failures that should occur
are related with the cryptographic
functions provided by the JCE.authorize(String, int, long)boolean authorize(String secret, int verificationCode, long time)
windowSize property of this class.
间隔大小使用RFC 6238推荐的默认值30秒。
secret - The encoded secret key.verificationCode - The verification code.time - The time to use to calculate the TOTP password.true if the validation code is valid, false
otherwise.GoogleAuthenticatorException - if a failure occurs during the
calculation of the validation code.
The only failures that should occur
are related with the cryptographic
functions provided by the JCE.boolean authorizeUser(String userName, int verificationCode)
authorizeUser(String, int, long).userName - 要验证其验证码的用户。verificationCode - The validation code.true if the validation code is valid,
false otherwise.GoogleAuthenticatorException - if an unexpected error occurs.authorize(String, int)boolean authorizeUser(String userName, int verificationCode, long time)
authorize(String, int, long) method.userName - The user whose verification code is to be
validated.verificationCode - The validation code.time - The time to use to calculate the TOTP password.true if the validation code is valid,
false otherwise.GoogleAuthenticatorException - if an unexpected error occurs.authorize(String, int)ICredentialRepository getCredentialRepository()
null if none is set or none can be found using the ServiceLoader
API.void setCredentialRepository(ICredentialRepository repository)
null is passed to this method, no credential repository will be
used, nor discovered using the ServiceLoader API.repository - The credential repository to use, or null to
disable this feature.Copyright © 2024. All rights reserved.