Class InMemoryUserCredentialRepository
java.lang.Object
com.codename1.backend.security.webauthn.InMemoryUserCredentialRepository
- All Implemented Interfaces:
UserCredentialRepository
public final class InMemoryUserCredentialRepository
extends Object
implements UserCredentialRepository
Credentials kept in this process: gone when it stops, and unknown to any
other server. For a test or a demonstration; a deployment keeps them in
the database with
JdbcUserCredentialRepository.-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionbooleanadvance(byte[] credentialId, long signatureCount, boolean uvInitialized, boolean backupState, long lastUsed) Records a sign-in: the counter the authenticator sent, the flags it sent, and when.booleandelete(byte[] credentialId) Removes a credential.findByCredentialId(byte[] credentialId) The credential with this id, or null.findByUserId(byte[] userEntityUserId) The credentials of the user with this handle, oldest first; empty when they have none.booleansave(CredentialRecord record) Stores a new credential.
-
Constructor Details
-
InMemoryUserCredentialRepository
public InMemoryUserCredentialRepository()
-
-
Method Details
-
save
Description copied from interface:UserCredentialRepositoryStores a new credential.- Specified by:
savein interfaceUserCredentialRepository- Returns:
- false, and nothing stored, when a credential with this id is there already -- this user's or another's
-
findByCredentialId
Description copied from interface:UserCredentialRepositoryThe credential with this id, or null.- Specified by:
findByCredentialIdin interfaceUserCredentialRepository
-
findByUserId
Description copied from interface:UserCredentialRepositoryThe credentials of the user with this handle, oldest first; empty when they have none.- Specified by:
findByUserIdin interfaceUserCredentialRepository
-
advance
public boolean advance(byte[] credentialId, long signatureCount, boolean uvInitialized, boolean backupState, long lastUsed) Description copied from interface:UserCredentialRepositoryRecords a sign-in: the counter the authenticator sent, the flags it sent, and when.
The counter is taken only when it is greater than the one stored -- or when both are zero, which is an authenticator that keeps no counter. One statement decides and stores, so of two requests with the same assertion one is refused.
- Specified by:
advancein interfaceUserCredentialRepository- Returns:
- false, and nothing changed, when the counter did not advance or the credential is gone
-
delete
public boolean delete(byte[] credentialId) Description copied from interface:UserCredentialRepositoryRemoves a credential.- Specified by:
deletein interfaceUserCredentialRepository- Returns:
- whether there was one
-