public class MultiSourceDb<I extends Identity,G extends Group> extends Object implements IamDb<I,G>
kCreateOperation, kDeleteOperation, kReadOperation, kWriteOperation| Constructor and Description |
|---|
MultiSourceDb(ServiceContainer sc,
org.json.JSONObject rawConfig) |
| Modifier and Type | Method and Description |
|---|---|
void |
addAlias(String userId,
String alias)
Add a username/alias for this user.
|
void |
addJwtValidator(JwtValidator v)
Add a JWT validator to the identity manager.
|
void |
addUserToGroup(String groupId,
String userId)
Add a user to a given group
|
I |
authenticate(ApiKeyCredential akc)
Authenticate with an API key and signature
|
I |
authenticate(JwtCredential jwt)
Authenticate with a JWT token
|
I |
authenticate(UsernamePasswordCredential upc)
Authenticate with a username and password
|
boolean |
canUser(String id,
Resource resource,
String operation)
Can the given user perform the requested access?
|
boolean |
completePasswordReset(String tag,
String newPassword)
Complete a password reset by providing a tag and a new password.
|
I |
createAnonymousUser()
Create a new anonymous user in the identity manager.
|
G |
createGroup(String groupDesc)
Create a group
|
G |
createGroup(String groupId,
String groupDesc)
Create a group with a given group ID
|
String |
createJwtToken(Identity ii)
Create a JWT token for the given identity.
|
String |
createTag(String userId,
String appTagType,
long duration,
TimeUnit durationTimeUnit,
String nonce)
Create a tag for a given user id with a particular type and duration.
|
I |
createUser(String userId)
Create a new user in the identity manager.
|
void |
deleteUser(String userId)
Delete a user from the identity manager.
|
List<String> |
findUsers(String startingWith)
Find users with a user ID that starts with the given string
|
AccessControlList |
getAclFor(Resource resource)
load an ACL for a resource
|
Collection<String> |
getAliasesFor(String userId)
Get the aliases for a userId.
|
Collection<String> |
getAllGroups()
Get all group IDs in this db.
|
Collection<String> |
getAllUsers()
Get all user IDs in this db.
|
String |
getUserIdForTag(String tag)
Retrieves the userId associated with a tag.
|
Set<String> |
getUsersGroups(String userId)
Find out which groups a user is a member of.
|
Set<String> |
getUsersInGroup(String groupId)
Get the set of user IDs in a particular group.
|
void |
invalidateJwtToken(String jwtToken)
Invalidate the given JWT token
|
Map<String,I> |
loadAllUsers()
Load all users in this identity manager.
|
ApiKey |
loadApiKeyRecord(String apiKey)
Load an API key record based on the API key ID.
|
G |
loadGroup(String id)
Get a group by its identifier.
|
I |
loadUser(String userId)
Load a user from the identity manager.
|
I |
loadUserOrAlias(String userIdOrAlias)
Load a user from the identity manager.
|
void |
onAclUpdate(AccessControlList accessControlList) |
void |
populateMetrics(MetricsCatalog metrics) |
void |
removeAlias(String alias)
Remove a username/alias from the database.
|
void |
removeMatchingTag(String userId,
String appTagType)
Remove any matching tag for the given user and type.
|
void |
removeUserFromGroup(String groupId,
String userId)
Remove a user from a given group
|
void |
restoreApiKey(ApiKey key)
Restore an API key into the API key store
|
void |
sweepExpiredTags()
Sweep any expired tags.
|
boolean |
userExists(String userId)
Find out if a given user exists.
|
boolean |
userOrAliasExists(String userIdOrAlias)
Find out if a given user or alias exists.
|
public MultiSourceDb(ServiceContainer sc, org.json.JSONObject rawConfig) throws Builder.BuildFailure
Builder.BuildFailurepublic boolean userExists(String userId) throws IamSvcException
IdentityManageruserExists in interface IdentityManager<I extends Identity>userId - a user IDIamSvcException - when the call cannot be completed due to a service errorpublic boolean userOrAliasExists(String userIdOrAlias) throws IamSvcException
IdentityManageruserOrAliasExists in interface IdentityManager<I extends Identity>userIdOrAlias - the user ID or an aliasIamSvcException - when the call cannot be completed due to a service errorpublic I loadUser(String userId) throws IamSvcException
IdentityManagerloadUser in interface IdentityManager<I extends Identity>userId - a user IDIamSvcException - when the call cannot be completed due to a service errorpublic I loadUserOrAlias(String userIdOrAlias) throws IamSvcException
IdentityManagerloadUserOrAlias in interface IdentityManager<I extends Identity>userIdOrAlias - the actual userId or an aliasIamSvcException - when the call cannot be completed due to a service errorpublic List<String> findUsers(String startingWith) throws IamSvcException
IdentityManagerfindUsers in interface IdentityManager<I extends Identity>startingWith - a prefix for usersIamSvcException - when the call cannot be completed due to a service errorpublic I createUser(String userId) throws IamIdentityExists, IamSvcException
IdentityManagercreateUser in interface IdentityManager<I extends Identity>userId - a user IDIamIdentityExists - if the user existsIamSvcException - when the call cannot be completed due to a service errorpublic I createAnonymousUser() throws IamSvcException
IdentityManagercreateAnonymousUser in interface IdentityManager<I extends Identity>IamSvcException - when the call cannot be completed due to a service errorpublic void deleteUser(String userId) throws IamSvcException
IdentityManagerdeleteUser in interface IdentityManager<I extends Identity>userId - a user IDIamSvcException - when the call cannot be completed due to a service errorpublic void addAlias(String userId, String alias) throws IamSvcException, IamBadRequestException
IdentityManageraddAlias in interface IdentityManager<I extends Identity>userId - a user IDalias - an aliasIamSvcException - when the call cannot be completed due to a service errorIamBadRequestException - if the request is illegalpublic void removeAlias(String alias) throws IamBadRequestException, IamSvcException
IdentityManagerremoveAlias in interface IdentityManager<I extends Identity>alias - an aliasIamBadRequestException - If a userId is provided.IamSvcException - when the call cannot be completed due to a service errorpublic Collection<String> getAliasesFor(String userId) throws IamSvcException, IamIdentityDoesNotExist
IdentityManagergetAliasesFor in interface IdentityManager<I extends Identity>userId - a user IDIamSvcException - when the call cannot be completed due to a service errorIamIdentityDoesNotExist - if the identity does not existpublic boolean completePasswordReset(String tag, String newPassword) throws IamSvcException
IdentityManagerrequestPasswordReset
for details on creating a password reset tag.completePasswordReset in interface IdentityManager<I extends Identity>tag - a tagnewPassword - a new passwordIamSvcException - when the call cannot be completed due to a service errorpublic ApiKey loadApiKeyRecord(String apiKey) throws IamSvcException
IdentityManagerloadApiKeyRecord in interface IdentityManager<I extends Identity>apiKey - an API keyIamSvcException - when the call cannot be completed due to a service errorpublic void restoreApiKey(ApiKey key) throws IamIdentityDoesNotExist, IamBadRequestException, IamSvcException
IdentityManagerrestoreApiKey in interface IdentityManager<I extends Identity>IamIdentityDoesNotExistIamBadRequestExceptionIamSvcExceptionpublic void addJwtValidator(JwtValidator v)
IdentityManageraddJwtValidator in interface IdentityManager<I extends Identity>v - a validatorpublic Collection<String> getAllUsers() throws IamSvcException
IdentityManagergetAllUsers in interface IdentityManager<I extends Identity>IamSvcException - when the call cannot be completed due to a service errorpublic Map<String,I> loadAllUsers() throws IamSvcException
IdentityManagerloadAllUsers in interface IdentityManager<I extends Identity>IamSvcException - when the call cannot be completed due to a service errorpublic I authenticate(UsernamePasswordCredential upc) throws IamSvcException
IdentityDbauthenticate in interface IdentityDb<I extends Identity>upc - the username/password credentialIamSvcException - when the call cannot be completed due to a service errorpublic I authenticate(ApiKeyCredential akc) throws IamSvcException
IdentityDbauthenticate in interface IdentityDb<I extends Identity>akc - the API key credentialIamSvcException - when the call cannot be completed due to a service errorpublic I authenticate(JwtCredential jwt) throws IamSvcException
IdentityDbauthenticate in interface IdentityDb<I extends Identity>jwt - the JWT credentialIamSvcException - when the call cannot be completed due to a service errorpublic String createJwtToken(Identity ii) throws IamSvcException
IdentityDbcreateJwtToken in interface IdentityDb<I extends Identity>ii - an identityIamSvcException - when the call cannot be completed due to a service errorpublic void invalidateJwtToken(String jwtToken) throws IamSvcException
IdentityDbinvalidateJwtToken in interface IdentityDb<I extends Identity>jwtToken - a JWT tokenIamSvcException - when the call cannot be completed due to a service errorpublic G createGroup(String groupDesc) throws IamGroupExists, IamSvcException
AccessManagercreateGroup in interface AccessManager<G extends Group>groupDesc - the group descriptionIamGroupExists - if the group already existsIamSvcException - when the call cannot be completed due to a service errorpublic G createGroup(String groupId, String groupDesc) throws IamGroupExists, IamSvcException
AccessManagercreateGroup in interface AccessManager<G extends Group>groupId - a group IDgroupDesc - a group descriptionIamGroupExists - if the group already existsIamSvcException - when the call cannot be completed due to a service errorpublic void addUserToGroup(String groupId, String userId) throws IamSvcException, IamIdentityDoesNotExist, IamGroupDoesNotExist
AccessManageraddUserToGroup in interface AccessManager<G extends Group>groupId - a group IDuserId - a user IDIamSvcException - when the call cannot be completed due to a service errorIamIdentityDoesNotExist - when the identity doesn't existIamGroupDoesNotExist - if the group does not existpublic void removeUserFromGroup(String groupId, String userId) throws IamSvcException, IamIdentityDoesNotExist, IamGroupDoesNotExist
AccessManagerremoveUserFromGroup in interface AccessManager<G extends Group>groupId - a group IDuserId - a user IDIamSvcException - when the call cannot be completed due to a service errorIamIdentityDoesNotExist - when the identity doesn't existIamGroupDoesNotExist - if the group does not existpublic Set<String> getUsersGroups(String userId) throws IamSvcException, IamIdentityDoesNotExist
AccessManagergetUsersGroups in interface AccessManager<G extends Group>userId - a user IDIamSvcException - when the call cannot be completed due to a service errorIamIdentityDoesNotExist - when the identity doesn't existpublic Set<String> getUsersInGroup(String groupId) throws IamSvcException, IamGroupDoesNotExist
AccessManagergetUsersInGroup in interface AccessManager<G extends Group>groupId - a group IDIamSvcException - when the call cannot be completed due to a service errorIamGroupDoesNotExist - when the identity doesn't existpublic Collection<String> getAllGroups() throws IamSvcException
AccessManagergetAllGroups in interface AccessManager<G extends Group>IamSvcException - when the call cannot be completed due to a service errorpublic G loadGroup(String id) throws IamSvcException
AccessDbloadGroup in interface AccessDb<G extends Group>id - the group's IDIamSvcException - if there's a problem in the IAM servicepublic AccessControlList getAclFor(Resource resource) throws IamSvcException
AccessDbgetAclFor in interface AccessDb<G extends Group>resource - the resource for which you want the ACLIamSvcException - if there's a problem in the IAM servicepublic boolean canUser(String id, Resource resource, String operation) throws IamSvcException
AccessDbcanUser in interface AccessDb<G extends Group>id - the identity/subject making the requestresource - the resource on which access is requestedoperation - the operationIamSvcException - if there's a problem in the IAM servicepublic String createTag(String userId, String appTagType, long duration, TimeUnit durationTimeUnit, String nonce) throws IamSvcException
TagManagercreateTag in interface TagManageruserId - a user IDappTagType - a tag typeduration - the length of time the tag should existdurationTimeUnit - the time unit for the durationnonce - used to seed random number generatorIamSvcException - if there's a problem in the IAM servicepublic String getUserIdForTag(String tag) throws IamSvcException
TagManagergetUserIdForTag in interface TagManagertag - a tag generated by createTagIamSvcException - if there's a problem in the IAM servicepublic void removeMatchingTag(String userId, String appTagType) throws IamSvcException
TagManagerremoveMatchingTag in interface TagManageruserId - a user IDappTagType - a tag typeIamSvcException - if there's a problem in the IAM servicepublic void sweepExpiredTags()
throws IamSvcException
TagManagersweepExpiredTags in interface TagManagerIamSvcException - if there's a problem in the IAM servicepublic void onAclUpdate(AccessControlList accessControlList)
onAclUpdate in interface AclUpdateListenerpublic void populateMetrics(MetricsCatalog metrics)
populateMetrics in interface MetricsSupplierCopyright © 2023 continual.io. All rights reserved.