public interface UserStore
Any implementation of a User Store is expected to not perform lengthy blocking operations as it might be called on the Main Thread. All implementations of this interface should be thread safe.
Modifier and Type | Method and Description |
---|---|
Collection<SyncUser> |
allUsers()
Returns a collection of all users saved in the User store.
|
SyncUser |
get(String identity,
String authenticationUrl)
Retrieves specified
SyncUser . |
SyncUser |
getCurrent()
Retrieves the current
SyncUser . |
boolean |
isActive(String identity,
String authenticationUrl)
Returns the state of the specified user:
true if active (not logged out), false otherwise. |
void |
put(SyncUser user)
Saves a
SyncUser object. |
void |
remove(String identity,
String authenticationUrl)
Removes the user from the store.
|
void put(SyncUser user)
SyncUser
object. If another user already exists, it will be replaced.
SyncUser.getIdentity()
is used as a unique identifier of a given SyncUser
.user
- SyncUser
object to store.SyncUser getCurrent()
SyncUser
.
This method will throw an exception if more than one valid, logged in users exist.
SyncUser
object or null
if not found.SyncUser get(String identity, String authenticationUrl)
SyncUser
.identity
- identity of the user.authenticationUrl
- the URL of the authentication.SyncUser
object or null
if not found.void remove(String identity, String authenticationUrl)
If the user is not found, this method does nothing.
identity
- identity of the user.authenticationUrl
- the URL of the authentication.Collection<SyncUser> allUsers()
boolean isActive(String identity, String authenticationUrl)
true
if active (not logged out), false
otherwise.
This method checks if the user was marked as logged out. If the user has expired but not actively logged out
this method will return true
.identity
- identity of the user.authenticationUrl
- the URL of the authentication.true
if the user is not logged out, false
otherwise.