Backend API. Server-side code: this runs in a Codename One backend, not in the app on the device.
public final class InMemoryUserCredentialRepository
- Object
- InMemoryUserCredentialRepository
ImplementsUserCredentialRepository
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.Constructors
public InMemoryUserCredentialRepository() |
Methods
public synchronized boolean save(CredentialRecord record) | Stores a new credential. |
public synchronized CredentialRecord findByCredentialId(byte[] credentialId) | The credential with this id, or null. |
public synchronized List<CredentialRecord> findByUserId(byte[] userEntityUserId) | The credentials of the user with this handle, oldest first; empty when they have none. |
public synchronized boolean advance(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. |
public synchronized boolean delete(byte[] credentialId) | Removes a credential. |
Inherited methods
Constructor details
InMemoryUserCredentialRepository
public InMemoryUserCredentialRepository()Method details
save
public synchronized boolean save(CredentialRecord record)Stores a new credential.
Returns
false, and nothing stored, when a credential with this id is
there already – this user’s or another’s
findByCredentialId
public synchronized CredentialRecord findByCredentialId(byte[] credentialId)The credential with this id, or null.
findByUserId
public synchronized List<CredentialRecord> findByUserId(byte[] userEntityUserId)The credentials of the user with this handle, oldest first; empty when
they have none.
advance
public synchronized boolean advance(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.
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.
Returns
false, and nothing changed, when the counter did not advance or
the credential is gone
delete
public synchronized boolean delete(byte[] credentialId)Removes a credential.
Returns
whether there was one