Package io.vertx.ext.auth.webauthn4j
Interface CredentialStorage
-
public interface CredentialStorage
Used to represent persistent storage of credentials, this gives you a way to abstract how you want to store them (in memory, database, other).
-
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description Future<List<Authenticator>>
find(String userName, String credentialId)
Finds an existing list of credentials for a given user name and credential ID.Future<Void>
storeCredential(Authenticator authenticator)
Persists a new credential, bound by its user name (may benull
) and credential ID (cannot benull
, must be unique).Future<Void>
updateCounter(Authenticator authenticator)
Updates a previously stored credential counter, as identified by its user name (may benull
) and credential ID (cannot benull
, must be unique).
-
-
-
Method Detail
-
find
Future<List<Authenticator>> find(String userName, String credentialId)
Finds an existing list of credentials for a given user name and credential ID. Both theuserName
andcredentialId
parameters are optional but at least one of them must be specified. If only one is specified, it must match the results. If both are specified, then both must match the result at the same time. This may return more than one element if one of the parameters is not set. If both are set, then the returned list of credentials must contain at maximum 1 element. If the user is not known or does not allow any authenticator, returns an empty list.- Parameters:
userName
- the user name (may benull
, but must match if specified)credentialId
- the credential ID (must match the results)- Returns:
- the list of authenticators allowed for the given userName and credential ID, or an empty list.
-
storeCredential
Future<Void> storeCredential(Authenticator authenticator)
Persists a new credential, bound by its user name (may benull
) and credential ID (cannot benull
, must be unique). If attempting to store a credential with acredId
that is not unique, you should return a failedFuture
. If attempting to store a credential with auserName
that already exists, you should first make sure that the current user is already logged in under the sameuserName
, because this will in practice add a new credential to identify the existing user, so this must be restricted to the already existing user, otherwise you will allow anyone to gain access to existing users. If attempting to store a credential with auserName
that already exists, and the current user is not logged in, or the logged in user does not have the sameuserName
, you should return a failedFuture
.- Parameters:
authenticator
- the new credential to persist- Returns:
- a future of nothing, or a failed future if the
credId
already exists, or if theuserName
already exists and does not represent the currently logged in user.
-
updateCounter
Future<Void> updateCounter(Authenticator authenticator)
Updates a previously stored credential counter, as identified by its user name (may benull
) and credential ID (cannot benull
, must be unique).- Parameters:
authenticator
- the credential to update- Returns:
- a future of nothing
-
-