Package io.vertx.ext.auth.otp.totp
Interface TotpAuth
-
- All Superinterfaces:
AuthenticationProvider
public interface TotpAuth extends AuthenticationProvider
An extension of AuthProvider which uses the one time passwords based on time to perform authentication.- Author:
- Dmitry Novikov
-
-
Method Summary
All Methods Static Methods Instance Methods Abstract Methods Default Methods Modifier and Type Method Description TotpAuth
authenticatorFetcher(java.util.function.Function<String,Future<Authenticator>> fetcher)
TotpAuth
authenticatorUpdater(java.util.function.Function<Authenticator,Future<Void>> updater)
Provide aFunction
that can update or insert aAuthenticator
.static TotpAuth
create()
Creates an instance of TotpAuth.static TotpAuth
create(TotpAuthOptions totpAuthOptions)
Creates an instance of TotpAuth.Future<Authenticator>
createAuthenticator(String id, OtpKey otpKey)
Creating authenticator from user id and key.default String
generateUri(OtpKey otpKey, String label)
Creating URI for register in key in user device.default String
generateUri(OtpKey otpKey, String issuer, String user)
Creating URI for register in key in user device.String
generateUri(OtpKey otpKey, String issuer, String user, String label)
Creating URI for register in key in user device.-
Methods inherited from interface io.vertx.ext.auth.authentication.AuthenticationProvider
authenticate
-
-
-
-
Method Detail
-
authenticatorFetcher
TotpAuth authenticatorFetcher(java.util.function.Function<String,Future<Authenticator>> fetcher)
Provide aFunction
that can fetchAuthenticator
s from a backend given anidentifier
argument.The function signature is as follows:
(id) -> Future<Authenticator>
id
the identifier to lookup.Future
async result with a authenticator.
- Parameters:
fetcher
- fetcher function.- Returns:
- fluent self.
-
authenticatorUpdater
TotpAuth authenticatorUpdater(java.util.function.Function<Authenticator,Future<Void>> updater)
Provide aFunction
that 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>
Authenticator
the authenticator data to update.Future
async result of the operation.
- Parameters:
updater
- updater function.- Returns:
- fluent self.
-
createAuthenticator
Future<Authenticator> createAuthenticator(String id, OtpKey otpKey)
Creating authenticator from user id and key.- Parameters:
id
- id user.otpKey
- key of user used for auth.- Returns:
Authenticator
an object containing all the necessary information to authenticate a user.
-
generateUri
String generateUri(OtpKey otpKey, String issuer, String user, String label)
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
default String generateUri(OtpKey otpKey, String issuer, String user)
Creating URI for register in key in user device.- Parameters:
otpKey
- user key.issuer
- issuer of key.user
- display name of user account.- Returns:
- uri containing the key.
-
generateUri
default String generateUri(OtpKey otpKey, String label)
Creating URI for register in key in user device.- Parameters:
otpKey
- user key.label
- the label to identify which account a key is associated with.- Returns:
- uri containing the key.
-
create
static TotpAuth create()
Creates an instance of TotpAuth.- Returns:
- the created instance of
TotpAuth
.
-
create
static TotpAuth create(TotpAuthOptions totpAuthOptions)
Creates an instance of TotpAuth.- Parameters:
totpAuthOptions
- the config.- Returns:
- the created instance of
TotpAuth
.
-
-