public class CommonJsonIdentity extends CommonJsonObject implements Identity
| Constructor and Description |
|---|
CommonJsonIdentity(String userId,
org.json.JSONObject userRecord,
CommonJsonDb<? extends CommonJsonIdentity,?> db) |
| Modifier and Type | Method and Description |
|---|---|
void |
addApiKey(String newApiKey) |
protected boolean |
addGroup(String groupId) |
org.json.JSONObject |
asJson() |
ApiKey |
createApiKey()
Create an API key for this user.
|
void |
deleteApiKey(ApiKey key)
Delete an API key from the user.
|
void |
enable(boolean enable)
Enable or disable the user.
|
String |
getApiKey()
Get the API key supplied to the constructor, if any.
|
protected org.json.JSONObject |
getDataRecord() |
Group |
getGroup(String groupId)
Get a group by ID if the user is a member.
|
Set<String> |
getGroupIds()
Get the IDs of the groups this user belongs to
|
Collection<Group> |
getGroups()
Get the groups this user belongs to
|
String |
getId()
Get the unique id for this user
|
String |
getPasswordHash() |
String |
getPasswordSalt() |
static org.json.JSONObject |
initializeIdentity() |
boolean |
isEnabled()
Is this identity enabled?
|
Collection<String> |
loadApiKeysForUser()
Load the set of API keys for this user.
|
static void |
main(String[] args) |
void |
reload()
reload this object from the server
|
protected boolean |
removeGroup(String groupId) |
String |
requestPasswordReset(long secondsUntilExpire,
String nonce)
Request a password reset.
|
void |
setApiKeyUsedForAuth(String apiKey) |
void |
setPassword(String password)
Set the user's password.
|
void |
setPasswordSaltAndHash(String salt,
String hash) |
protected void |
store() |
String |
toString() |
getAllUserData, getUserData, getValue, getValue, putUserData, removeUserData, removeValue, setValueclone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, waitgetAllUserData, getUserData, putUserData, removeUserDatapublic CommonJsonIdentity(String userId, org.json.JSONObject userRecord, CommonJsonDb<? extends CommonJsonIdentity,?> db)
public static org.json.JSONObject initializeIdentity()
public String getId()
Identitypublic void setApiKeyUsedForAuth(String apiKey)
public String getApiKey()
public org.json.JSONObject asJson()
public void setPassword(String password) throws IamSvcException
IdentitysetPassword in interface Identitypassword - a passwordIamSvcException - when the call cannot be completed due to a service errorpublic void setPasswordSaltAndHash(String salt, String hash) throws IamSvcException
IamSvcExceptionpublic String requestPasswordReset(long secondsUntilExpire, String nonce) throws IamSvcException, IamBadRequestException
IdentityrequestPasswordReset in interface IdentitysecondsUntilExpire - amount of time until the generated tag expiresnonce - arbitrary user data used to create the tagIamSvcException - when the call cannot be completed due to a service errorIamIdentityDoesNotExist - when the identity doesn't existIamBadRequestException - when the request is now allowedpublic ApiKey createApiKey() throws IamSvcException
IdentitycreateApiKey in interface IdentityIamSvcException - when the call cannot be completed due to a service errorpublic Collection<String> loadApiKeysForUser() throws IamSvcException
IdentityloadApiKeysForUser in interface IdentityIamSvcException - when the call cannot be completed due to a service errorpublic void deleteApiKey(ApiKey key) throws IamSvcException
IdentitydeleteApiKey in interface Identitykey - the API key to removeIamSvcException - when the call cannot be completed due to a service errorpublic void enable(boolean enable)
throws IamSvcException
Identityenable in interface Identityenable - if true, enable the userIamSvcException - when the call cannot be completed due to a service errorpublic boolean isEnabled()
Identitypublic String getPasswordSalt()
public String getPasswordHash()
public Set<String> getGroupIds() throws IamSvcException
IdentitygetGroupIds in interface IdentityIamSvcException - when the call cannot be completed due to a service errorpublic Collection<Group> getGroups() throws IamSvcException
IdentitygetGroups in interface IdentityIamSvcException - when the call cannot be completed due to a service errorpublic Group getGroup(String groupId) throws IamSvcException
IdentitygetGroup in interface IdentitygroupId - the ID of the group to retrieveIamSvcException - when the call cannot be completed due to a service errorpublic void addApiKey(String newApiKey)
protected boolean addGroup(String groupId)
protected boolean removeGroup(String groupId)
protected org.json.JSONObject getDataRecord()
getDataRecord in class CommonJsonObjectpublic void reload()
throws IamSvcException
UserDataHolderreload in interface UserDataHolderreload in class CommonJsonObjectIamSvcException - if there's a problem in the IAM serviceprotected void store()
throws IamSvcException
store in class CommonJsonObjectIamSvcExceptionpublic static void main(String[] args)
Copyright © 2023 continual.io. All rights reserved.