Package com.sas.lsaf.security.user
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:
LsafClient.getUserService()
,ServiceManager.getUserService()
-
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description void
changePassword(java.lang.String oldPassword, java.lang.String newPassword)
Changes the current user password.User
createUser(UserCreateInfo userInfo)
Creates a user in the system.void
deleteUser(java.lang.String userId)
Deletes a user who has performed no actions in the system.java.lang.String
encryptPassword(byte[] password)
Gets an encrypted version of a password.java.util.Set<UserDescriptor>
getAllUserDescriptors()
Gets the lightweight representation of all users that are defined in the system.java.util.Set<User>
getAllUsers()
Gets the full representation of all the users that are defined in the system.java.util.List<AuthenticationProviderInfo>
getAuthenticationProviderInfos()
Gets a list of available authentication providers that can be specified as part of a user account in the system.java.lang.String
getCurrentUserId()
Gets the user identifier of the current user.java.util.Set<LicenseType>
getLicenseTypes()
Retrieves the license types currently configured in the system.User
getUserByUserId(java.lang.String userId)
Gets the full representation of a user given their user identifier.UserDescriptor
getUserDescriptorByUserId(java.lang.String userId)
Gets the lightweight representation of the user with the specified user identifier.java.util.Set<UserDescriptor>
getUserDescriptorsByUserIds(java.util.Set<java.lang.String> userIds)
Gets the lightweight client representation for the specified user identifiers that can be found in the system.java.util.Set<User>
getUsersByUserIds(java.util.Set<java.lang.String> userIds)
Gets the full representations for the specified user identifiers.void
lockUser(java.lang.String userId)
Locks a user with the specified user identifier.void
resetPassword(java.lang.String userId, java.lang.String newPassword)
Resets the password of a user.User
setDefaultAuthenticatorByUserId(java.lang.String userId, java.lang.String newPassword)
Sets the specified user account to use the default authenticator and the new password specified.User
setExternalAuthenticatorByUserId(java.lang.String userId, java.lang.String authenticator, java.lang.String authenticatorUsername)
Sets the external authenticator for a user.void
unlockUser(java.lang.String userId)
Unlocks a user with the specified user identifier.User
updateUser(User user)
Updates a user in the system.boolean
userExists(java.lang.String userId)
Determines whether a user with the specified user identifier exists in the system.
-
-
-
Method Detail
-
createUser
User createUser(UserCreateInfo userInfo) throws UserExistsException, UserPasswordException
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(java.lang.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(java.lang.String oldPassword, java.lang.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(java.lang.String userId, java.lang.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(java.lang.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(java.lang.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
java.util.Set<User> getUsersByUserIds(java.util.Set<java.lang.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(java.lang.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
java.util.Set<UserDescriptor> getUserDescriptorsByUserIds(java.util.Set<java.lang.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(java.lang.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(java.lang.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
java.util.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
java.util.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
java.lang.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
java.util.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(java.lang.String userId, java.lang.String authenticator, java.lang.String authenticatorUsername) throws UserNotFoundException
Sets the external authenticator for a user. To return to using the system default authentication for this user, use the methodsetDefaultAuthenticatorByUserId(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(java.lang.String userId, java.lang.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 theresetPassword(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
java.util.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
usingLicenseType.getName()
.
-
getCurrentUserId
java.lang.String getCurrentUserId()
Gets the user identifier of the current user.- Returns:
- The user identifier of the current user.
-
-