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
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, kUserIdFields inherited from interface io.continual.iam.access.AccessDb
kCreateOperation, kDeleteOperation, kReadOperation, kWriteOperation -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidclose()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 voidprotected voidprotected voidprotected voidprotected voiddeleteTagObject(String id, String userId, String appTagType) protected voidFind users with a user ID that starts with the given stringGet all group IDs in this db.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.JSONObjectLoad all users in this identity manager.protected org.json.JSONObjectprotected Collection<String>loadApiKeysForUser(String userId) protected org.json.JSONObjectprotected org.json.JSONObjectloadTagObject(String id, boolean expiredOk) protected org.json.JSONObjectloadTagObject(String userId, String appTagType, boolean expiredOk) protected org.json.JSONObjectloadUserObject(String id) 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) voidSweep 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
-
Constructor Details
-
JsonDocDb
public JsonDocDb() -
JsonDocDb
public JsonDocDb(org.json.JSONObject doc)
-
-
Method Details
-
close
public void close() -
serialize
-
findUsers
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
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
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
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
Description 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
- Specified by:
createNewUserin classCommonJsonDb<CommonJsonIdentity,CommonJsonGroup>
-
loadUserObject
- Specified by:
loadUserObjectin classCommonJsonDb<CommonJsonIdentity,CommonJsonGroup> - Throws:
IamSvcException
-
storeUserObject
- Specified by:
storeUserObjectin classCommonJsonDb<CommonJsonIdentity,CommonJsonGroup> - Throws:
IamSvcException
-
deleteUserObject
- Specified by:
deleteUserObjectin classCommonJsonDb<CommonJsonIdentity,CommonJsonGroup> - Throws:
IamSvcException
-
instantiateIdentity
- Specified by:
instantiateIdentityin classCommonJsonDb<CommonJsonIdentity,CommonJsonGroup>
-
createNewGroup
- Specified by:
createNewGroupin classCommonJsonDb<CommonJsonIdentity,CommonJsonGroup>
-
loadGroupObject
- Specified by:
loadGroupObjectin classCommonJsonDb<CommonJsonIdentity,CommonJsonGroup> - Throws:
IamSvcException
-
storeGroupObject
- Specified by:
storeGroupObjectin classCommonJsonDb<CommonJsonIdentity,CommonJsonGroup> - Throws:
IamSvcException
-
deleteGroupObject
- Specified by:
deleteGroupObjectin classCommonJsonDb<CommonJsonIdentity,CommonJsonGroup> - Throws:
IamSvcException
-
instantiateGroup
- Specified by:
instantiateGroupin classCommonJsonDb<CommonJsonIdentity,CommonJsonGroup>
-
createApiKeyObject
- Specified by:
createApiKeyObjectin classCommonJsonDb<CommonJsonIdentity,CommonJsonGroup>
-
loadApiKeyObject
- 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
- Specified by:
deleteApiKeyObjectin classCommonJsonDb<CommonJsonIdentity,CommonJsonGroup> - Throws:
IamSvcException
-
instantiateApiKey
- 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
- Specified by:
loadAclObjectin classCommonJsonDb<CommonJsonIdentity,CommonJsonGroup> - Throws:
IamSvcException
-
storeAclObject
- Specified by:
storeAclObjectin classCommonJsonDb<CommonJsonIdentity,CommonJsonGroup> - Throws:
IamSvcException
-
deleteAclObject
- Specified by:
deleteAclObjectin classCommonJsonDb<CommonJsonIdentity,CommonJsonGroup> - Throws:
IamSvcException
-
loadTagObject
- 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
- Specified by:
deleteTagObjectin classCommonJsonDb<CommonJsonIdentity,CommonJsonGroup> - Throws:
IamSvcException
-
loadAliasObject
- 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
- 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
- Specified by:
storeInvalidJwtTokenin classCommonJsonDb<CommonJsonIdentity,CommonJsonGroup> - Throws:
IamSvcException
-
isInvalidJwtToken
- Specified by:
isInvalidJwtTokenin classCommonJsonDb<CommonJsonIdentity,CommonJsonGroup> - Throws:
IamSvcException
-