public abstract class ApiKeyAuth extends Object
Modifier and Type | Method and Description |
---|---|
ApiKey |
create(String name)
Creates a user API key that can be used to authenticate as the user.
|
RealmAsyncTask |
createAsync(String name,
App.Callback<ApiKey> callback)
Asynchronously creates a user API key that can be used to authenticate as the user.
|
void |
delete(ObjectId id)
Deletes a specific API key created by the user.
|
RealmAsyncTask |
deleteAsync(ObjectId id,
App.Callback<Void> callback)
Deletes a specific API key created by the user.
|
void |
disable(ObjectId id)
Disables a specific API key created by the user.
|
RealmAsyncTask |
disableAsync(ObjectId id,
App.Callback<Void> callback)
Disables a specific API key created by the user.
|
void |
enable(ObjectId id)
Enables a specific API key created by the user.
|
RealmAsyncTask |
enableAsync(ObjectId id,
App.Callback<Void> callback)
Enables a specific API key created by the user.
|
boolean |
equals(Object o) |
ApiKey |
fetch(ObjectId id)
Fetches a specific user API key associated with the user.
|
List<ApiKey> |
fetchAll()
Fetches all API keys associated with the user.
|
RealmAsyncTask |
fetchAll(App.Callback<List<ApiKey>> callback)
Fetches all API keys associated with the user.
|
RealmAsyncTask |
fetchAsync(ObjectId id,
App.Callback<ApiKey> callback)
Fetches a specific user API key associated with the user.
|
App |
getApp()
Returns the
App that this instance in associated with. |
User |
getUser()
Returns the
User that this instance in associated with. |
int |
hashCode() |
String |
toString() |
public User getUser()
User
that this instance in associated with.User
that this instance in associated with.public App getApp()
App
that this instance in associated with.App
that this instance in associated with.public ApiKey create(String name) throws AppException
The value of the key must be persisted at this time as this is the only time it is visible.
The key is enabled when created. It can be disabled by calling disable(ObjectId)
.
name
- the name of the keyAppException
- if the server failed to create the API key.public RealmAsyncTask createAsync(String name, App.Callback<ApiKey> callback)
The value of the key must be persisted at this time as this is the only time it is visible.
The key is enabled when created. It can be disabled by calling disable(ObjectId)
.
name
- the name of the keycallback
- callback when key creation has completed or failed. The callback will always
happen on the same thread as this method is called on.IllegalStateException
- if called from a non-looper thread.public ApiKey fetch(ObjectId id) throws AppException
id
- the id of the key to fetch.AppException
- if the server failed to fetch the API key.public RealmAsyncTask fetchAsync(ObjectId id, App.Callback<ApiKey> callback)
id
- the id of the key to fetch.callback
- callback used when the key was fetched or the call failed. The callback
will always happen on the same thread as this method was called on.IllegalStateException
- if called from a non-looper thread.public List<ApiKey> fetchAll() throws AppException
AppException
- if the server failed to fetch the API keys.public RealmAsyncTask fetchAll(App.Callback<List<ApiKey>> callback)
callback
- callback used when the keys were fetched or the call failed. The callback
will always happen on the same thread as this method was called on.IllegalStateException
- if called from a non-looper thread.public void delete(ObjectId id) throws AppException
id
- the id of the key to delete.AppException
- if the server failed to delete the API key.public RealmAsyncTask deleteAsync(ObjectId id, App.Callback<Void> callback)
id
- the id of the key to delete.callback
- callback used when the was deleted or the call failed. The callback
will always happen on the same thread as this method was called on.IllegalStateException
- if called from a non-looper thread.public void disable(ObjectId id) throws AppException
id
- the id of the key to disable.AppException
- if the server failed to disable the API key.public RealmAsyncTask disableAsync(ObjectId id, App.Callback<Void> callback)
id
- the id of the key to disable.callback
- callback used when the key was disabled or the call failed. The callback
will always happen on the same thread as this method was called on.IllegalStateException
- if called from a non-looper thread.public void enable(ObjectId id) throws AppException
id
- the id of the key to enable.AppException
- if the server failed to enable the API key.public RealmAsyncTask enableAsync(ObjectId id, App.Callback<Void> callback)
id
- the id of the key to enable.callback
- callback used when the key was enabled or the call failed. The callback
will always happen on the same thread as this method was called on.IllegalStateException
- if called from a non-looper thread.