Package io.continual.iam.impl.jsondoc
Class JsonDocDb
- java.lang.Object
-
- io.continual.iam.impl.common.CommonJsonDb<CommonJsonIdentity,CommonJsonGroup>
-
- io.continual.iam.impl.jsondoc.JsonDocDb
-
- All Implemented Interfaces:
AccessDb<CommonJsonGroup>,AccessManager<CommonJsonGroup>,AclUpdateListener,IamDb<CommonJsonIdentity,CommonJsonGroup>,IdentityDb<CommonJsonIdentity>,IdentityManager<CommonJsonIdentity>,TagManager,MetricsSupplier,Closeable,AutoCloseable
public class JsonDocDb extends CommonJsonDb<CommonJsonIdentity,CommonJsonGroup>
This "database" is a single JSON document.
-
-
Nested Class Summary
-
Nested classes/interfaces inherited from class io.continual.iam.impl.common.CommonJsonDb
CommonJsonDb.AclFactory
-
-
Field Summary
-
Fields inherited from class io.continual.iam.impl.common.CommonJsonDb
kAlias, kCreateTsMs, kEnabled, kExpireEpoch, kPasswordBlock, kPasswordHash, kPasswordSalt, kSecret, kTagId, kTagType, kTagType_PasswordReset, kUserId
-
Fields inherited from interface io.continual.iam.access.AccessDb
kCreateOperation, kDeleteOperation, kReadOperation, kWriteOperation
-
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidclose()protected org.json.JSONObjectcreateApiKeyObject(String userId, String apiKey, String apiSecret)protected org.json.JSONObjectcreateNewGroup(String id, String groupDesc)protected org.json.JSONObjectcreateNewUser(String id)protected voiddeleteAclObject(String id)protected voiddeleteAliasObject(String id)protected voiddeleteApiKeyObject(String id)protected voiddeleteGroupObject(String id)protected voiddeleteTagObject(String id, String userId, String appTagType)protected voiddeleteUserObject(String id)List<String>findUsers(String startingWith)Find users with a user ID that starts with the given stringCollection<String>getAllGroups()Get all group IDs in this db.Collection<String>getAllUsers()Get all user IDs in this db.protected ApiKeyinstantiateApiKey(String id, org.json.JSONObject data)protected CommonJsonGroupinstantiateGroup(String id, org.json.JSONObject data)protected CommonJsonIdentityinstantiateIdentity(String id, org.json.JSONObject data)protected booleanisInvalidJwtToken(String token)protected org.json.JSONObjectloadAclObject(String id)protected Collection<String>loadAliasesForUser(String userId)protected org.json.JSONObjectloadAliasObject(String id)Map<String,CommonJsonIdentity>loadAllUsers()Load all users in this identity manager.protected org.json.JSONObjectloadApiKeyObject(String id)protected Collection<String>loadApiKeysForUser(String userId)protected org.json.JSONObjectloadGroupObject(String id)protected org.json.JSONObjectloadTagObject(String id, boolean expiredOk)protected org.json.JSONObjectloadTagObject(String userId, String appTagType, boolean expiredOk)protected org.json.JSONObjectloadUserObject(String id)Stringserialize()protected voidstoreAclObject(String id, org.json.JSONObject data)protected voidstoreAliasObject(String apiKeyId, org.json.JSONObject data)protected voidstoreApiKeyObject(String apiKeyId, org.json.JSONObject data)protected voidstoreGroupObject(String id, org.json.JSONObject data)protected voidstoreInvalidJwtToken(String token)protected voidstoreTagObject(String id, String userId, String appTagType, org.json.JSONObject data)protected voidstoreUserObject(String id, org.json.JSONObject data)voidsweepExpiredTags()Sweep any expired tags.-
Methods inherited from class io.continual.iam.impl.common.CommonJsonDb
addAlias, addJwtValidator, addUserToGroup, aliasExists, authenticate, authenticate, authenticate, canUser, completePasswordReset, createAnonymousUser, createApiKey, createGroup, createGroup, createJwtToken, createTag, createUser, deleteUser, generateKey, getAclFor, getAliasesFor, getAppNonce, getUserIdForTag, getUsersGroups, getUsersInGroup, invalidateJwtToken, loadApiKeyRecord, loadGroup, loadUser, loadUserOrAlias, onAclUpdate, populateMetrics, removeAlias, removeMatchingTag, removeUserFromGroup, restoreApiKey, userExists, userOrAliasExists
-
-
-
-
Method Detail
-
close
public void close()
-
serialize
public String serialize()
-
findUsers
public List<String> findUsers(String startingWith) throws IamSvcException
Description copied from interface:IdentityManagerFind users with a user ID that starts with the given string- Parameters:
startingWith- a prefix for users- Returns:
- a list of 0 or more matching user IDs
- Throws:
IamSvcException- when the call cannot be completed due to a service error
-
getAllUsers
public Collection<String> getAllUsers() throws IamSvcException
Description copied from interface:IdentityManagerGet all user IDs in this db. Clearly not suitable for systems beyond a few thousand users. For larger scale, this call may throw an IamSvcException signaling that the underlying database won't return a user list.- Returns:
- a collection of user Ids
- Throws:
IamSvcException- when the call cannot be completed due to a service error
-
getAllGroups
public Collection<String> getAllGroups() throws IamSvcException
Description copied from interface:AccessManagerGet all group IDs in this db. Clearly not suitable for systems beyond a few thousand groups. For larger scale, this call may throw an IamSvcException signaling that the underlying database won't return a group list.- Returns:
- a collection of group Ids
- Throws:
IamSvcException- when the call cannot be completed due to a service error
-
loadAllUsers
public Map<String,CommonJsonIdentity> loadAllUsers() throws IamSvcException
Description copied from interface:IdentityManagerLoad all users in this identity manager. Clearly not suitable for systems beyond a few thousand users. For larger scale, this call may throw an IamSvcException signaling that the underlying database won't return a user list.- Returns:
- a map of user ID to identity
- Throws:
IamSvcException- when the call cannot be completed due to a service error
-
sweepExpiredTags
public void sweepExpiredTags() throws IamSvcExceptionDescription copied from interface:TagManagerSweep any expired tags. The tag manager implementation may not actually require this operation. In that case, make it a no-op.- Throws:
IamSvcException- if there's a problem in the IAM service
-
createNewUser
protected org.json.JSONObject createNewUser(String id)
- Specified by:
createNewUserin classCommonJsonDb<CommonJsonIdentity,CommonJsonGroup>
-
loadUserObject
protected org.json.JSONObject loadUserObject(String id) throws IamSvcException
- Specified by:
loadUserObjectin classCommonJsonDb<CommonJsonIdentity,CommonJsonGroup>- Throws:
IamSvcException
-
storeUserObject
protected void storeUserObject(String id, org.json.JSONObject data) throws IamSvcException
- Specified by:
storeUserObjectin classCommonJsonDb<CommonJsonIdentity,CommonJsonGroup>- Throws:
IamSvcException
-
deleteUserObject
protected void deleteUserObject(String id) throws IamSvcException
- Specified by:
deleteUserObjectin classCommonJsonDb<CommonJsonIdentity,CommonJsonGroup>- Throws:
IamSvcException
-
instantiateIdentity
protected CommonJsonIdentity instantiateIdentity(String id, org.json.JSONObject data)
- Specified by:
instantiateIdentityin classCommonJsonDb<CommonJsonIdentity,CommonJsonGroup>
-
createNewGroup
protected org.json.JSONObject createNewGroup(String id, String groupDesc)
- Specified by:
createNewGroupin classCommonJsonDb<CommonJsonIdentity,CommonJsonGroup>
-
loadGroupObject
protected org.json.JSONObject loadGroupObject(String id) throws IamSvcException
- Specified by:
loadGroupObjectin classCommonJsonDb<CommonJsonIdentity,CommonJsonGroup>- Throws:
IamSvcException
-
storeGroupObject
protected void storeGroupObject(String id, org.json.JSONObject data) throws IamSvcException
- Specified by:
storeGroupObjectin classCommonJsonDb<CommonJsonIdentity,CommonJsonGroup>- Throws:
IamSvcException
-
deleteGroupObject
protected void deleteGroupObject(String id) throws IamSvcException
- Specified by:
deleteGroupObjectin classCommonJsonDb<CommonJsonIdentity,CommonJsonGroup>- Throws:
IamSvcException
-
instantiateGroup
protected CommonJsonGroup instantiateGroup(String id, org.json.JSONObject data)
- Specified by:
instantiateGroupin classCommonJsonDb<CommonJsonIdentity,CommonJsonGroup>
-
createApiKeyObject
protected org.json.JSONObject createApiKeyObject(String userId, String apiKey, String apiSecret)
- Specified by:
createApiKeyObjectin classCommonJsonDb<CommonJsonIdentity,CommonJsonGroup>
-
loadApiKeyObject
protected org.json.JSONObject loadApiKeyObject(String id) throws IamSvcException
- Specified by:
loadApiKeyObjectin classCommonJsonDb<CommonJsonIdentity,CommonJsonGroup>- Throws:
IamSvcException
-
storeApiKeyObject
protected void storeApiKeyObject(String apiKeyId, org.json.JSONObject data) throws IamSvcException, IamBadRequestException
- Specified by:
storeApiKeyObjectin classCommonJsonDb<CommonJsonIdentity,CommonJsonGroup>- Throws:
IamSvcExceptionIamBadRequestException
-
deleteApiKeyObject
protected void deleteApiKeyObject(String id) throws IamSvcException
- Specified by:
deleteApiKeyObjectin classCommonJsonDb<CommonJsonIdentity,CommonJsonGroup>- Throws:
IamSvcException
-
instantiateApiKey
protected ApiKey instantiateApiKey(String id, org.json.JSONObject data)
- Specified by:
instantiateApiKeyin classCommonJsonDb<CommonJsonIdentity,CommonJsonGroup>
-
loadApiKeysForUser
protected Collection<String> loadApiKeysForUser(String userId) throws IamSvcException, IamIdentityDoesNotExist
- Specified by:
loadApiKeysForUserin classCommonJsonDb<CommonJsonIdentity,CommonJsonGroup>- Throws:
IamSvcExceptionIamIdentityDoesNotExist
-
loadAclObject
protected org.json.JSONObject loadAclObject(String id) throws IamSvcException
- Specified by:
loadAclObjectin classCommonJsonDb<CommonJsonIdentity,CommonJsonGroup>- Throws:
IamSvcException
-
storeAclObject
protected void storeAclObject(String id, org.json.JSONObject data) throws IamSvcException
- Specified by:
storeAclObjectin classCommonJsonDb<CommonJsonIdentity,CommonJsonGroup>- Throws:
IamSvcException
-
deleteAclObject
protected void deleteAclObject(String id) throws IamSvcException
- Specified by:
deleteAclObjectin classCommonJsonDb<CommonJsonIdentity,CommonJsonGroup>- Throws:
IamSvcException
-
loadTagObject
protected org.json.JSONObject loadTagObject(String id, boolean expiredOk) throws IamSvcException
- Specified by:
loadTagObjectin classCommonJsonDb<CommonJsonIdentity,CommonJsonGroup>- Throws:
IamSvcException
-
loadTagObject
protected org.json.JSONObject loadTagObject(String userId, String appTagType, boolean expiredOk) throws IamSvcException
- Specified by:
loadTagObjectin classCommonJsonDb<CommonJsonIdentity,CommonJsonGroup>- Throws:
IamSvcException
-
storeTagObject
protected void storeTagObject(String id, String userId, String appTagType, org.json.JSONObject data) throws IamSvcException
- Specified by:
storeTagObjectin classCommonJsonDb<CommonJsonIdentity,CommonJsonGroup>- Throws:
IamSvcException
-
deleteTagObject
protected void deleteTagObject(String id, String userId, String appTagType) throws IamSvcException
- Specified by:
deleteTagObjectin classCommonJsonDb<CommonJsonIdentity,CommonJsonGroup>- Throws:
IamSvcException
-
loadAliasObject
protected org.json.JSONObject loadAliasObject(String id) throws IamSvcException
- Specified by:
loadAliasObjectin classCommonJsonDb<CommonJsonIdentity,CommonJsonGroup>- Throws:
IamSvcException
-
storeAliasObject
protected void storeAliasObject(String apiKeyId, org.json.JSONObject data) throws IamBadRequestException, IamSvcException
- Specified by:
storeAliasObjectin classCommonJsonDb<CommonJsonIdentity,CommonJsonGroup>- Throws:
IamBadRequestExceptionIamSvcException
-
deleteAliasObject
protected void deleteAliasObject(String id) throws IamSvcException
- Specified by:
deleteAliasObjectin classCommonJsonDb<CommonJsonIdentity,CommonJsonGroup>- Throws:
IamSvcException
-
loadAliasesForUser
protected Collection<String> loadAliasesForUser(String userId) throws IamSvcException, IamIdentityDoesNotExist
- Specified by:
loadAliasesForUserin classCommonJsonDb<CommonJsonIdentity,CommonJsonGroup>- Throws:
IamSvcExceptionIamIdentityDoesNotExist
-
storeInvalidJwtToken
protected void storeInvalidJwtToken(String token) throws IamSvcException
- Specified by:
storeInvalidJwtTokenin classCommonJsonDb<CommonJsonIdentity,CommonJsonGroup>- Throws:
IamSvcException
-
isInvalidJwtToken
protected boolean isInvalidJwtToken(String token) throws IamSvcException
- Specified by:
isInvalidJwtTokenin classCommonJsonDb<CommonJsonIdentity,CommonJsonGroup>- Throws:
IamSvcException
-
-