Interface HotpAuth
- All Superinterfaces:
AuthenticationProvider
An extension of AuthProvider which uses the one time passwords based on counter to perform authentication.
- Author:
- Dmitry Novikov
-
Method Summary
Modifier and TypeMethodDescriptionauthenticatorFetcher(Function<String, Future<Authenticator>> fetcher) authenticatorUpdater(Function<Authenticator, Future<Void>> updater) Provide aFunctionthat can update or insert aAuthenticator.static HotpAuthcreate()Creates an instance of HotpAuth.static HotpAuthcreate(HotpAuthOptions hotpAuthOptions) Creates an instance of HotpAuth.createAuthenticator(String id, OtpKey otpKey) Creating authenticator from user id and key.default StringgenerateUri(OtpKey otpKey, String label) Creating URI for register in key in user device.default StringgenerateUri(OtpKey otpKey, String issuer, String user) Creating URI for register in key in user device.generateUri(OtpKey otpKey, String issuer, String user, String label) Creating URI for register in key in user device.Methods inherited from interface AuthenticationProvider
authenticate
-
Method Details
-
authenticatorFetcher
Provide aFunctionthat can fetchAuthenticators from a backend given anidentifierargument.The function signature is as follows:
(id) -> Future<Authenticator>idthe identifier to lookup.Futureasync result with a authenticator.
- Parameters:
fetcher- fetcher function.- Returns:
- fluent self.
-
authenticatorUpdater
Provide aFunctionthat can update or insert aAuthenticator. The function should store a given authenticator to a persistence storage.When an authenticator is already present, this method must at least update
Authenticator.getCounter(), and is not required to perform any other update.For new authenticators, the whole object data must be persisted.
The function signature is as follows:
(Authenticator) -> Future<Void>Authenticatorthe authenticator data to update.Futureasync result of the operation.
- Parameters:
updater- updater function.- Returns:
- fluent self.
-
createAuthenticator
Creating authenticator from user id and key.- Parameters:
id- id user.otpKey- key of user used for auth.- Returns:
Authenticatoran object containing all the necessary information to authenticate a user.
-
generateUri
Creating URI for register in key in user device.- Parameters:
otpKey- user key.issuer- issuer of key.user- display name of user account.label- the label to identify which account a key is associated with.- Returns:
- uri containing the key.
-
generateUri
-
generateUri
-
create
-
create
Creates an instance of HotpAuth.- Parameters:
hotpAuthOptions- the config.- Returns:
- the created instance of
HotpAuth.
-