Interface UserService


public interface UserService
Provides methods to manage the lifecycle of a user and to get information about a user that is defined in the system.
Since:
1.2
See Also:
  • Method Details

    • createUser

      Creates a user in the system.
      Parameters:
      userInfo - creation information with values to use to create a user instance.
      Returns:
      The newly created user instance.
      Throws:
      UserExistsException - thrown when a user with the specified user ID already exists in the system.
      UserPasswordException - thrown when the initial password specified does not meet the password validation criteria.
    • updateUser

      User updateUser(User user) throws UserNotFoundException
      Updates a user in the system.
      Parameters:
      user - the user to update.
      Returns:
      The updated user instance.
      Throws:
      UserNotFoundException - thrown when a user with the specified user identifier cannot be found in the system.
    • deleteUser

      void deleteUser(String userId) throws UserNotFoundException, UserDeleteException
      Deletes a user who has performed no actions in the system. Once a user has logged into the system, they can no longer be deleted and instead can only be locked or deactivated.
      Parameters:
      userId - the user identifier of the user to delete from the system.
      Throws:
      UserNotFoundException - thrown when a user with the specified user identifier cannot be found in the system.
      UserDeleteException - thrown when a user cannot be deleted because they have previously logged into the system or they are assigned resources.
    • changePassword

      void changePassword(String oldPassword, String newPassword) throws UserPasswordException, AuthenticationException
      Changes the current user password.
      Parameters:
      oldPassword - the old password.
      newPassword - the new password.
      Throws:
      UserPasswordException - thrown if the new password does not meet the password validation criteria.
      AuthenticationException - thrown if the old password is incorrect, or the account being used is locked, expired, or inactive.
    • resetPassword

      void resetPassword(String userId, String newPassword) throws UserNotFoundException, UserPasswordException
      Resets the password of a user. Resetting the password of a user is an administrative action that forces the user to change their password upon next logon.
      Parameters:
      userId - the user identifier of the user to be assigned a new password.
      newPassword - the new password to assign to the user.
      Throws:
      UserNotFoundException - thrown when a user with the user identifier cannot be found in the system.
      UserPasswordException - thrown if the new password does not meet the password validation criteria.
    • userExists

      boolean userExists(String userId)
      Determines whether a user with the specified user identifier exists in the system.
      Parameters:
      userId - the user identifier to check.
      Returns:
      True if a user with the user identifier exists in the system, false otherwise.
    • getUserByUserId

      User getUserByUserId(String userId) throws UserNotFoundException
      Gets the full representation of a user given their user identifier.
      Parameters:
      userId - the user identifier to fetch.
      Returns:
      The user if it exists.
      Throws:
      UserNotFoundException - thrown when a user with the specified user ID cannot be found in the system.
    • getUsersByUserIds

      Set<User> getUsersByUserIds(Set<String> userIds)
      Gets the full representations for the specified user identifiers. If a user identifier does not exist in the system then it is ignored.
      Parameters:
      userIds - the set of user identifiers.
      Returns:
      The set of users that were successfully found.
    • getUserDescriptorByUserId

      UserDescriptor getUserDescriptorByUserId(String userId) throws UserNotFoundException
      Gets the lightweight representation of the user with the specified user identifier.
      Parameters:
      userId - the user identifier.
      Returns:
      The specified user.
      Throws:
      UserNotFoundException - thrown when a user with the specified user identifier cannot be found in the system.
    • getUserDescriptorsByUserIds

      Set<UserDescriptor> getUserDescriptorsByUserIds(Set<String> userIds)
      Gets the lightweight client representation for the specified user identifiers that can be found in the system. If a user identifier does not exist in the system then it is ignored.
      Parameters:
      userIds - the set of user identifiers.
      Returns:
      The set of user descriptors that were successfully found.
    • lockUser

      void lockUser(String userId) throws UserNotFoundException, UserLockedException
      Locks a user with the specified user identifier.
      Parameters:
      userId - the user identifier.
      Throws:
      UserNotFoundException - thrown when a user with the specified user identifier cannot be found in the system.
      UserLockedException - thrown if the account is already locked.
    • unlockUser

      void unlockUser(String userId) throws UserNotFoundException, UserUnlockedException
      Unlocks a user with the specified user identifier.
      Parameters:
      userId - the user identifier.
      Throws:
      UserNotFoundException - thrown when a user with the specified user identifier cannot be found in the system.
      UserUnlockedException - thrown if the account is already unlocked.
    • getAllUsers

      Set<User> getAllUsers()
      Gets the full representation of all the users that are defined in the system.
      Returns:
      The complete set of all users that are defined in the system.
    • getAllUserDescriptors

      Set<UserDescriptor> getAllUserDescriptors()
      Gets the lightweight representation of all users that are defined in the system.
      Returns:
      The complete set of user descriptors that are defined in the system.
    • encryptPassword

      String encryptPassword(byte[] password)
      Gets an encrypted version of a password. The encrypted password can be used only to log on through the API. It should not be used to log on to the system interactively.
      Parameters:
      password - the clear text password.
      Returns:
      The encrypted password.
    • getAuthenticationProviderInfos

      List<AuthenticationProviderInfo> getAuthenticationProviderInfos()
      Gets a list of available authentication providers that can be specified as part of a user account in the system.
      Returns:
      The list of currently configured authentication providers.
    • setExternalAuthenticatorByUserId

      User setExternalAuthenticatorByUserId(String userId, String authenticator, String authenticatorUsername) throws UserNotFoundException
      Sets the external authenticator for a user. To return to using the system default authentication for this user, use the method setDefaultAuthenticatorByUserId(String, String), which will require a new password.
      Parameters:
      userId - the user identifier to set an external authenticator.
      authenticator - the id of the authentication provider to use.
      authenticatorUsername - (optional) the user name in which to log in to the external authentication provider.
      Returns:
      The user with the updated external authenticator information.
      Throws:
      UserNotFoundException - thrown when a user with the specified user identifier cannot be found in the system.
    • setDefaultAuthenticatorByUserId

      User setDefaultAuthenticatorByUserId(String userId, String newPassword) throws UserNotFoundException
      Sets the specified user account to use the default authenticator and the new password specified. This method is similar in behavior to the resetPassword(String, String) method. After the password has been reset, it immediately expires. Therefore, when the user logs in with the new password, they will be required to change it before accessing the system.
      Parameters:
      userId - the user identifier in which to set the default authenticator.
      newPassword - the new password that is required when switching from an external authenticator provider.
      Returns:
      The user with the updated default authenticator information.
      Throws:
      UserNotFoundException - thrown when a user with the specified user identifier cannot be found in the system.
    • getLicenseTypes

      Set<LicenseType> getLicenseTypes()
      Retrieves the license types currently configured in the system.
      Returns:
      The set of license types that can be set on the AccountInfo using LicenseType.getName().
    • getCurrentUserId

      String getCurrentUserId()
      Gets the user identifier of the current user.
      Returns:
      The user identifier of the current user.