@Component public class UserManagerImpl extends ManagerHelperImpl<User> implements UserManager
UserManager.AuthType, UserManager.UpdateField, UserManager.UserJoinStatus
Modifier and Type | Field and Description |
---|---|
static java.lang.String |
classType |
HIDE_PASSWORD, INVALID_CREDENTIALS_MSG
Constructor and Description |
---|
UserManagerImpl() |
Modifier and Type | Method and Description |
---|---|
AuthenticationData |
authenticate(java.lang.String loginName,
java.lang.String password,
boolean rememberMe)
Authenticates the provided credentials in the context of the current partner reference
|
void |
changePassword(XInfo xinfo,
java.lang.String newPassword) |
User |
findByLogin(java.lang.String loginName)
Returns the User with the provided login name in the context of the current partner reference.
|
User |
findByLogin(java.lang.String partnerRef,
java.lang.String loginName)
Returns the User with the provided login name in the context of a partner reference.
|
java.util.List<java.lang.String> |
findJoinedApplications(java.lang.String loginName)
Returns the list of partner references a user has joined.
|
Pair<UserManager.UserJoinStatus,User> |
getJoinedStatus(java.lang.String loginName)
Returns whether a user exists and if so whether the user belongs to the current
partner reference
|
Pair<UserManager.UserJoinStatus,User> |
getJoinedStatus(java.lang.String partnerRef,
java.lang.String loginName) |
User |
getUser(java.lang.String accessToken)
Returns the User associated with an access token.
|
User |
getUser(XInfo xinfo)
Returns the User represented by the specified external reference information in the
context of the current partner reference.
|
User |
joinApplication()
Connects the currently authenticated user with the running partner application or service.
|
User |
joinApplication(java.lang.String loginName,
java.lang.String password)
Connects a user with the running partner application or service.
|
User |
joinApplication(java.lang.String partnerRef,
java.lang.String loginName,
java.lang.String password)
Connects a user with the specified partner application or service.
|
User |
leaveApplication()
Disconnects the currently authenticated user with the running partner application or service.
|
User |
leaveApplication(java.lang.String loginName,
java.lang.String password) |
User |
leaveApplication(java.lang.String partnerRef,
java.lang.String loginName,
java.lang.String password) |
void |
logout() |
User |
persist(UserBuilder ub)
Persists a
User object, creating an external reference linking the user to the current partner reference. |
User |
persist(UserBuilder ub,
java.util.UUID reservation)
Persists a
User object, creating an external reference linking the user to the current partner reference. |
java.util.UUID |
reserveLoginName(java.lang.String loginName)
Returns whether a login name is already in use.
|
void |
update(XInfo xInfo,
java.util.List<Pair<UserManager.UpdateField,java.lang.Object>> values) |
createExternalReferenceFor
public java.util.UUID reserveLoginName(java.lang.String loginName) throws AlreadyExistsException
UserManager
If the name is available, reserves the name for ReservedNameList.RESERVE_SECONDS_DEFAULT
seconds.
reserveLoginName
in interface UserManager
loginName
- Login name to check.AlreadyExistsException
- loginName is already in use or reserved.public AuthenticationData authenticate(java.lang.String loginName, java.lang.String password, boolean rememberMe) throws AuthenticationException, java.lang.IllegalArgumentException, NotFoundException
UserManager
authenticate
in interface UserManager
loginName
- User's login namepassword
- User's passwordrememberMe
- true when applicable, create a cookie for this user; otherwise falseAuthenticationException
java.lang.IllegalArgumentException
NotFoundException
public Pair<UserManager.UserJoinStatus,User> getJoinedStatus(java.lang.String loginName)
UserManager
getJoinedStatus
in interface UserManager
loginName
- User's login namepublic Pair<UserManager.UserJoinStatus,User> getJoinedStatus(java.lang.String partnerRef, java.lang.String loginName)
getJoinedStatus
in interface UserManager
public User joinApplication() throws NotFoundException, AuthenticationException
UserManager
joinApplication
in interface UserManager
NotFoundException
AuthenticationException
public User leaveApplication() throws NotFoundException, AuthenticationException
UserManager
leaveApplication
in interface UserManager
NotFoundException
AuthenticationException
public User joinApplication(java.lang.String loginName, java.lang.String password) throws NotFoundException, AuthenticationException, AlreadyExistsException, java.lang.IllegalArgumentException
UserManager
joinApplication
in interface UserManager
loginName
- User's login namepassword
- User's passwordNotFoundException
AuthenticationException
AlreadyExistsException
java.lang.IllegalArgumentException
public User leaveApplication(java.lang.String loginName, java.lang.String password) throws NotFoundException, AuthenticationException, AlreadyExistsException, java.lang.IllegalArgumentException
leaveApplication
in interface UserManager
NotFoundException
AuthenticationException
AlreadyExistsException
java.lang.IllegalArgumentException
public User joinApplication(java.lang.String partnerRef, java.lang.String loginName, java.lang.String password) throws NotFoundException, AuthenticationException, AlreadyExistsException, java.lang.IllegalArgumentException
UserManager
Note: For use only by Service Administrators.
joinApplication
in interface UserManager
loginName
- User's login namepassword
- User's passwordNotFoundException
AuthenticationException
AlreadyExistsException
java.lang.IllegalArgumentException
public User leaveApplication(java.lang.String partnerRef, java.lang.String loginName, java.lang.String password) throws NotFoundException, AuthenticationException, AlreadyExistsException, java.lang.IllegalArgumentException
leaveApplication
in interface UserManager
NotFoundException
AuthenticationException
AlreadyExistsException
java.lang.IllegalArgumentException
public User persist(UserBuilder ub) throws AlreadyExistsException, NotFoundException
UserManager
User
object, creating an external reference linking the user to the current partner reference.persist
in interface UserManager
ub
- Contains the data necessary for creating a new user.
The minimal data necessary:
AlreadyExistsException
NotFoundException
public User persist(UserBuilder ub, java.util.UUID reservation) throws AlreadyExistsException, NotFoundException
UserManager
User
object, creating an external reference linking the user to the current partner reference.persist
in interface UserManager
ub
- Contains the data necessary for creating a new user. See UserManager.persist(UserBuilder)
.reservation
- A reservation for a login name returned from UserManager.reserveLoginName(String)
.AlreadyExistsException
NotFoundException
public User getUser(XInfo xinfo) throws NotFoundException
UserManager
getUser
in interface UserManager
xinfo
- External reference informationNotFoundException
public User getUser(java.lang.String accessToken) throws NotFoundException
UserManager
getUser
in interface UserManager
accessToken
- Access tokenNotFoundException
- If the access token does not exist.public User findByLogin(java.lang.String loginName) throws NotFoundException
UserManager
findByLogin
in interface UserManager
loginName
- The user's login nameNotFoundException
- No user is found with that login name.public User findByLogin(java.lang.String partnerRef, java.lang.String loginName) throws NotFoundException
UserManager
Note: For use only by Service Administrators.
findByLogin
in interface UserManager
partnerRef
- Partner referenceloginName
- The user's login nameNotFoundException
- No user is found with that login name.public java.util.List<java.lang.String> findJoinedApplications(java.lang.String loginName) throws NotFoundException
UserManager
findJoinedApplications
in interface UserManager
loginName
- User's login nameNotFoundException
public void update(XInfo xInfo, java.util.List<Pair<UserManager.UpdateField,java.lang.Object>> values) throws ForbiddenException, NotFoundException
update
in interface UserManager
ForbiddenException
NotFoundException
public void changePassword(XInfo xinfo, java.lang.String newPassword) throws NotFoundException
changePassword
in interface UserManager
NotFoundException
public void logout()
logout
in interface UserManager