Package com.carfey.ops.api.embedded
Class UserManager
- java.lang.Object
-
- com.carfey.ops.api.embedded.AbstractAPIManager
-
- com.carfey.ops.api.embedded.UserManager
-
public class UserManager extends AbstractAPIManager
Class to manage users using the Obsidian public embedded API. This class can only manage native Obsidian users and does not support LDAP or other authentication methods. SeeAbstractAPIManagerfor details on how transactions are managed within all requests.Example:
UserListing listing = new UserManager().listUsers(); System.out.println("Users: " + listing);- Since:
- 3.0
- See Also:
- Embedded API Wiki, REST API Wiki
-
-
Nested Class Summary
-
Nested classes/interfaces inherited from class com.carfey.ops.api.embedded.AbstractAPIManager
AbstractAPIManager.ActionCallable
-
-
Constructor Summary
Constructors Constructor Description UserManager()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description UseraddUser(UserCreationRequest request, java.lang.String auditUser)Creates a new user with the supplied configuration.UserdeleteUser(long userId, java.lang.String auditUser)Deletes the requested user.UsergetUser(long userId)Loads details on an existing user.MfaUserListinglistMfaUsers()Returns all known users which may have MFA resets applied.UserListinglistUsers()Lists configured users.MfaUserListingresetMfa(ResetMfaRequest request, java.lang.String auditUser)Resets the requested user's multi-factor authentication state so that they may perform MFA setup.UserupdateUser(long userId, UserUpdateRequest request, java.lang.String auditUser)Updates the requested user with the supplied configuration.-
Methods inherited from class com.carfey.ops.api.embedded.AbstractAPIManager
addParameter, runApiTarget, validateRequired, withTransaction
-
-
-
-
Method Detail
-
listUsers
public UserListing listUsers() throws java.lang.Exception
Lists configured users.- Returns:
- the full
UserListing - Throws:
java.lang.Exception- Any type of unexpected exception.- Since:
- 3.0
-
getUser
public User getUser(long userId) throws MissingEntityException, java.lang.Exception
Loads details on an existing user.- Parameters:
userId- ID of the user to load- Returns:
- the configured
User - Throws:
MissingEntityException- If the user with the requested ID does not exist.java.lang.Exception- Any other type of unexpected exception.- Since:
- 3.0
-
addUser
public User addUser(UserCreationRequest request, java.lang.String auditUser) throws ValidationException, java.lang.Exception
Creates a new user with the supplied configuration.- Parameters:
request- the user to saveauditUser- Optional user that is marked in audit columns. Defaults to "embeddedAPI".- Returns:
- the updated
User - Throws:
ValidationException- A validation error which prevents the action from succeeding.java.lang.Exception- Any other type of unexpected exception.- Since:
- 3.0
-
updateUser
public User updateUser(long userId, UserUpdateRequest request, java.lang.String auditUser) throws ValidationException, MissingEntityException, java.lang.Exception
Updates the requested user with the supplied configuration.- Parameters:
userId- ID of the user to updaterequest- the user to saveauditUser- Optional user that is marked in audit columns. Defaults to "embeddedAPI".- Returns:
- the updated
User - Throws:
ValidationException- A validation error which prevents the action from succeeding.MissingEntityException- If the user with the requested ID does not exist.java.lang.Exception- Any other type of unexpected exception.- Since:
- 3.0
-
deleteUser
public User deleteUser(long userId, java.lang.String auditUser) throws ValidationException, MissingEntityException, java.lang.Exception
Deletes the requested user.- Parameters:
userId- ID of the user to deleteauditUser- Optional user that is marked in audit columns. Defaults to "embeddedAPI".- Returns:
- the deleted
User - Throws:
ValidationException- A validation error which prevents the action from succeeding.MissingEntityException- If the user with the requested ID does not exist.java.lang.Exception- Any other type of unexpected exception.- Since:
- 3.0
-
resetMfa
public MfaUserListing resetMfa(ResetMfaRequest request, java.lang.String auditUser) throws ValidationException, java.lang.Exception
Resets the requested user's multi-factor authentication state so that they may perform MFA setup.- Parameters:
request- containing user names (login user name) to reset. This may include users that are not yet known and have not attempted a login in the past.auditUser- Optional user that is marked in audit columns. Defaults to "embeddedAPI".- Returns:
- listing of the updated users
- Throws:
ValidationException- A validation error which prevents the action from succeeding.java.lang.Exception- Any other type of unexpected exception.- Since:
- 5.0
-
listMfaUsers
public MfaUserListing listMfaUsers() throws java.lang.Exception
Returns all known users which may have MFA resets applied. Exists to facilitate use ofresetMfa(ResetMfaRequest, String)in cases where Obsidian's native authentication is not used. When native authentication is used, this will be a listing of all users. When other authentication methods are used, this will include users who have have MFA resets applied and those who have attempted login after MFA was enabled.- Returns:
- listing of known MFA users
- Throws:
java.lang.Exception- Any type of unexpected exception.- Since:
- 5.0
-
-