Package io.continual.iam.identity
Interface Identity
-
- All Superinterfaces:
UserDataHolder
- All Known Implementing Classes:
CommonJsonIdentity
public interface Identity extends UserDataHolder
An identity (user) in this system.
-
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description ApiKeycreateApiKey()Create an API key for this user.voiddeleteApiKey(ApiKey key)Delete an API key from the user.voidenable(boolean enable)Enable or disable the user.GroupgetGroup(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 toCollection<Group>getGroups()Get the groups this user belongs toStringgetId()Get the unique id for this userbooleanisEnabled()Is this identity enabled?Collection<String>loadApiKeysForUser()Load the set of API keys for this user.StringrequestPasswordReset(long secondsUntilExpire, String nonce)Request a password reset.voidsetPassword(String password)Set the user's password.-
Methods inherited from interface io.continual.iam.identity.UserDataHolder
getAllUserData, getUserData, putUserData, reload, removeUserData
-
-
-
-
Method Detail
-
getId
String getId()
Get the unique id for this user- Returns:
- a unique ID
-
isEnabled
boolean isEnabled() throws IamSvcExceptionIs this identity enabled?- Returns:
- true if enabled
- Throws:
IamSvcException- when the call cannot be completed due to a service error
-
enable
void enable(boolean enable) throws IamSvcExceptionEnable or disable the user. When disabled, authentication will fail.- Parameters:
enable- if true, enable the user- Throws:
IamSvcException- when the call cannot be completed due to a service error
-
setPassword
void setPassword(String password) throws IamSvcException
Set the user's password. Implementations of this interface should be careful to store the password indirectly (e.g. via salted hash), but this is not enforced at the interface layer.- Parameters:
password- a password- Throws:
IamSvcException- when the call cannot be completed due to a service error
-
requestPasswordReset
String requestPasswordReset(long secondsUntilExpire, String nonce) throws IamSvcException, IamBadRequestException
Request a password reset. The response is a unique tag that would normally be distributed to the user via email as a link. The user acknowledges the password change request by clicking the link. The link handler then calls completePasswordReset().- Parameters:
secondsUntilExpire- amount of time until the generated tag expiresnonce- arbitrary user data used to create the tag- Returns:
- a unique tag
- Throws:
IamSvcException- when the call cannot be completed due to a service errorIamIdentityDoesNotExist- when the identity doesn't existIamBadRequestException- when the request is now allowed
-
createApiKey
ApiKey createApiKey() throws IamSvcException
Create an API key for this user.- Returns:
- an API key
- Throws:
IamSvcException- when the call cannot be completed due to a service error
-
loadApiKeysForUser
Collection<String> loadApiKeysForUser() throws IamSvcException
Load the set of API keys for this user.- Returns:
- a set of 0 or more API keys
- Throws:
IamSvcException- when the call cannot be completed due to a service error
-
deleteApiKey
void deleteApiKey(ApiKey key) throws IamSvcException
Delete an API key from the user.- Parameters:
key- the API key to remove- Throws:
IamSvcException- when the call cannot be completed due to a service error
-
getGroupIds
Set<String> getGroupIds() throws IamSvcException
Get the IDs of the groups this user belongs to- Returns:
- a set of group IDs
- Throws:
IamSvcException- when the call cannot be completed due to a service error
-
getGroups
Collection<Group> getGroups() throws IamSvcException
Get the groups this user belongs to- Returns:
- a set of groups
- Throws:
IamSvcException- when the call cannot be completed due to a service error
-
getGroup
Group getGroup(String groupId) throws IamSvcException
Get a group by ID if the user is a member. Otherwise, null is returned.- Parameters:
groupId- the ID of the group to retrieve- Returns:
- a group or null if not a member
- Throws:
IamSvcException- when the call cannot be completed due to a service error
-
-