Package ca.ubc.ece.flowable.idm
Class IdentityService
- java.lang.Object
-
- ca.ubc.ece.flowable.idm.IdentityService
-
public class IdentityService extends java.lang.Object
Class for providing identity services.
-
-
Constructor Summary
Constructors Constructor Description IdentityService()
-
Method Summary
Modifier and Type Method Description static void
addUserToGroup(java.lang.String userId, java.lang.String groupId)
Adds a user to a group.static org.flowable.idm.api.Token
createToken(java.lang.String userId, java.lang.String remoteAddress, java.lang.String userAgent)
Creates a token.static boolean
createUser(java.lang.String userId, java.lang.String firstName, java.lang.String lastName, java.lang.String displayName, java.lang.String email)
Creates a new user.static boolean
deleteUserInfo(java.lang.String userId, java.lang.String key)
Deletes the user info for the user and the key.static java.util.List<org.flowable.idm.api.Group>
findGroups(java.lang.String userId)
Finds the groups for a user.static org.flowable.idm.api.Token
findTokenById(java.lang.String tokenId)
Returns the token with the matching token id.static org.flowable.idm.api.User
findUserByEmail(java.lang.String email)
Returns the user with the matching email.static org.flowable.idm.api.User
findUserById(java.lang.String userId)
Returns the user with the matching user id.static java.lang.String
findUserIdByUserInfo(java.lang.String key, java.lang.String value)
Returns the user id for the user info key and value.static java.util.List<java.lang.String>
findUserInfoKeys(java.lang.String userId)
Returns the info keys for the user.static java.lang.String
getUserInfo(java.lang.String userId, java.lang.String key)
Returns the user info value for the user and the key.static boolean
setUserInfo(java.lang.String userId, java.lang.String key, java.lang.String value)
Sets the user info value for the user and the key.static boolean
updateUser(java.lang.String userId, java.lang.String firstName, java.lang.String lastName, java.lang.String displayName, java.lang.String email)
Updates an existing user.
-
-
-
Method Detail
-
findUserById
public static org.flowable.idm.api.User findUserById(java.lang.String userId)
Returns the user with the matching user id.- Parameters:
userId
- the user id- Returns:
- the user
-
findUserByEmail
public static org.flowable.idm.api.User findUserByEmail(java.lang.String email)
Returns the user with the matching email.- Parameters:
email
- the email- Returns:
- the user
-
findGroups
public static java.util.List<org.flowable.idm.api.Group> findGroups(java.lang.String userId)
Finds the groups for a user.- Parameters:
userId
- the user id- Returns:
- the groups for the user
-
addUserToGroup
public static void addUserToGroup(java.lang.String userId, java.lang.String groupId)
Adds a user to a group.- Parameters:
userId
- the user idgroupId
- the group id
-
findUserInfoKeys
public static java.util.List<java.lang.String> findUserInfoKeys(java.lang.String userId)
Returns the info keys for the user.- Parameters:
userId
- the user id- Returns:
- the info keys
-
getUserInfo
public static java.lang.String getUserInfo(java.lang.String userId, java.lang.String key)
Returns the user info value for the user and the key.- Parameters:
userId
- the user idkey
- the key- Returns:
- the user info value
-
findUserIdByUserInfo
public static java.lang.String findUserIdByUserInfo(java.lang.String key, java.lang.String value)
Returns the user id for the user info key and value.- Parameters:
key
- the info keyvalue
- the info value- Returns:
- the user id
-
setUserInfo
public static boolean setUserInfo(java.lang.String userId, java.lang.String key, java.lang.String value)
Sets the user info value for the user and the key.- Parameters:
userId
- the user idkey
- the keyvalue
- the value- Returns:
- true if the user info was created successfully; false otherwise
-
deleteUserInfo
public static boolean deleteUserInfo(java.lang.String userId, java.lang.String key)
Deletes the user info for the user and the key.- Parameters:
userId
- the user idkey
- the key- Returns:
- true if the user info was deleted successfully; false otherwise
-
createUser
public static boolean createUser(java.lang.String userId, java.lang.String firstName, java.lang.String lastName, java.lang.String displayName, java.lang.String email)
Creates a new user.- Parameters:
userId
- the user idfirstName
- the user's first namelastName
- the user's last namedisplayName
- the user's display nameemail
- the user's email- Returns:
- true if the user was created successfully; false otherwise
-
updateUser
public static boolean updateUser(java.lang.String userId, java.lang.String firstName, java.lang.String lastName, java.lang.String displayName, java.lang.String email)
Updates an existing user.- Parameters:
userId
- the user idfirstName
- the user's first namelastName
- the user's last namedisplayName
- the user's display nameemail
- the user's email- Returns:
- true if the user was updated successfully; false otherwise
-
findTokenById
public static org.flowable.idm.api.Token findTokenById(java.lang.String tokenId)
Returns the token with the matching token id.- Parameters:
tokenId
- the token id- Returns:
- the token
-
createToken
public static org.flowable.idm.api.Token createToken(java.lang.String userId, java.lang.String remoteAddress, java.lang.String userAgent)
Creates a token.- Parameters:
userId
- the user idremoteAddress
- the remote addressuserAgent
- the user agent- Returns:
- the token
-
-