public class CachingUserManager extends Object implements UserManager
Constructor and Description |
---|
CachingUserManager(SecurityServerClient securityServerClient,
BasicCache basicCache) |
Modifier and Type | Method and Description |
---|---|
void |
addAllUsers(Collection<SOAPPrincipalWithCredential> users)
Adds all users to Crowd.
|
SOAPPrincipal |
addUser(SOAPPrincipal user,
PasswordCredential credential)
Adds a user to Crowd.
|
List |
getAllUserNames()
This optimises the background getAllUserNames() call.
|
SOAPPrincipal |
getUser(String userName)
Given a
userName , fetches the user's details, either from cache or from the Crowd server. |
SOAPPrincipal |
getUserFromToken(String token)
Note: the lookup is not currently cached - it will always hit the server.
|
SOAPPrincipal |
getUserWithAttributes(String userName)
Given a
userName , fetches the user's details and their associated attributes, either from cache or from the Crowd server. |
boolean |
isUser(String userName)
With JIRA we're guaranteed that if there are any names in the user list, all the names are in the user list.
|
void |
removeUser(String userName)
Removes a user from Crowd.
|
List |
searchUsers(SearchRestriction[] restrictions)
Searches the list of all available users based on the passed-in
restrictions and returns a list
of users that match. |
void |
updatePassword(String userName,
PasswordCredential credential)
Changes the password for the user specified by
userName . |
void |
updateUser(SOAPPrincipal user)
Updates a user's details in Crowd.
|
public CachingUserManager(SecurityServerClient securityServerClient, BasicCache basicCache)
public SOAPPrincipal getUser(String userName) throws RemoteException, InvalidAuthorizationTokenException, UserNotFoundException, InvalidAuthenticationException
UserManager
userName
, fetches the user's details, either from cache or from the Crowd server.getUser
in interface UserManager
userName
- The user's identifierRemoteException
- A communication error occurred - the Crowd server may not be available.InvalidAuthorizationTokenException
- The application (not the user) was not authenticated correctly.UserNotFoundException
- Could not find the user.InvalidAuthenticationException
- if the application name/password combination is invalidpublic SOAPPrincipal getUserWithAttributes(String userName) throws RemoteException, InvalidAuthorizationTokenException, UserNotFoundException, InvalidAuthenticationException
UserManager
userName
, fetches the user's details and their associated attributes, either from cache or from the Crowd server.getUserWithAttributes
in interface UserManager
userName
- The user's identifierRemoteException
- A communication error occurred - the Crowd server may not be available.InvalidAuthorizationTokenException
- The application (not the user) was not authenticated correctly.UserNotFoundException
- Could not find the user.InvalidAuthenticationException
- if the application name/password combination is invalidpublic SOAPPrincipal getUserFromToken(String token) throws RemoteException, InvalidAuthorizationTokenException, InvalidTokenException, InvalidAuthenticationException
getUserFromToken
in interface UserManager
token
- The token presented by the client browser to the webserver.RemoteException
- A communication error occurred - the Crowd server may not be available.InvalidAuthorizationTokenException
- The application (not the user) was not authenticated correctly.InvalidTokenException
- The token presented was not a valid Crowd token.InvalidAuthenticationException
- if the application name/password combination is invalidpublic List searchUsers(SearchRestriction[] restrictions) throws RemoteException, InvalidAuthorizationTokenException, InvalidAuthenticationException
UserManager
restrictions
and returns a list
of users that match.searchUsers
in interface UserManager
restrictions
- search restrictionsList
of SOAPPrincipal
s that match the criteria.RemoteException
- A communication error occurred - the Crowd server may not be available.InvalidAuthorizationTokenException
- The application (not the user) was not authenticated correctly.InvalidAuthenticationException
- if the application name/password combination is invalidpublic SOAPPrincipal addUser(SOAPPrincipal user, PasswordCredential credential) throws RemoteException, ApplicationPermissionException, InvalidCredentialException, InvalidUserException, InvalidAuthorizationTokenException, InvalidAuthenticationException
UserManager
addUser
in interface UserManager
user
- The user to add to Crowdcredential
- The credential (eg. password) for the user. May be null.SOAPPrincipal
, as returned by the Crowd server.RemoteException
- A communication error occurred - the Crowd server may not be available.ApplicationPermissionException
- The application does not have rights to add users.InvalidCredentialException
- The credentials were malformed or did not meet directory complexity
requirements.InvalidUserException
- The user was malformed or already exists.InvalidAuthorizationTokenException
- The application (not the user) was not authenticated correctly.InvalidAuthenticationException
- if the application name/password combination is invalidpublic void addAllUsers(Collection<SOAPPrincipalWithCredential> users) throws InvalidAuthorizationTokenException, BulkAddFailedException, RemoteException, ApplicationPermissionException, InvalidAuthenticationException
UserManager
addAllUsers
in interface UserManager
users
- The users to add to CrowdInvalidAuthorizationTokenException
- The application (not the user) was not authenticated correctly.BulkAddFailedException
- Thrown if it failed to create a user in of the directories.RemoteException
- A communication error occurred - the Crowd server may not be available.ApplicationPermissionException
- The application does not have rights to add users.InvalidAuthenticationException
- if the application name/password combination is invalidpublic void updateUser(SOAPPrincipal user) throws RemoteException, ApplicationPermissionException, InvalidAuthorizationTokenException, UserNotFoundException, InvalidAuthenticationException
UserManager
updateUser
in interface UserManager
user
- The user to updateRemoteException
- A communication error occurred - the Crowd server may not be available.ApplicationPermissionException
- This application does not have the rights to update the user.InvalidAuthorizationTokenException
- The application (not the user) was not authenticated correctly.UserNotFoundException
- The user to update could not be found.InvalidAuthenticationException
- if the application name/password combination is invalidpublic void updatePassword(String userName, PasswordCredential credential) throws RemoteException, InvalidAuthorizationTokenException, InvalidCredentialException, ApplicationPermissionException, UserNotFoundException, InvalidAuthenticationException
UserManager
userName
.updatePassword
in interface UserManager
userName
- The identifier of the usercredential
- The new credentials for the user.RemoteException
- A communication error occurred - the Crowd server may not be available.InvalidAuthorizationTokenException
- The application (not the user) was not authenticated correctly.InvalidCredentialException
- The credentials were malformed or did not meet directory complexity
requirements.ApplicationPermissionException
- This application does not have the rights to update the user's password.UserNotFoundException
- The user could not be found in any directory mapped to this application.InvalidAuthenticationException
- if the application name/password combination is invalidpublic void removeUser(String userName) throws RemoteException, InvalidAuthorizationTokenException, ApplicationPermissionException, UserNotFoundException, InvalidAuthenticationException
UserManager
removeUser
in interface UserManager
userName
- The name of the user to remove.RemoteException
- A communication error occurred - the Crowd server may not be available.InvalidAuthorizationTokenException
- The application (not the user) was not authenticated correctly.ApplicationPermissionException
- This application is not allowed to remove this user.UserNotFoundException
- The user to remove could not be found.InvalidAuthenticationException
- if the application name/password combination is invalidpublic List getAllUserNames() throws RemoteException, InvalidAuthorizationTokenException, InvalidAuthenticationException
The optimisation reduces the number of directory scans to one. A huge benefit, particularly with Active Directory.
getAllUserNames
in interface UserManager
List
of String
s that list all the users visible to this application.RemoteException
- A communication error occurred - the Crowd server may not be available.InvalidAuthorizationTokenException
- The application (not the user) was not authenticated correctly.InvalidAuthenticationException
- if the application name/password combination is invalidpublic boolean isUser(String userName) throws RemoteException, InvalidAuthorizationTokenException, InvalidAuthenticationException
isUser
in interface UserManager
userName
- name of the userRemoteException
- A communication error occurred - the Crowd server may not be available.InvalidAuthorizationTokenException
- The application (not the user) was not authenticated correctly.InvalidAuthenticationException
- if the application name/password combination is invalidCopyright © 2018 Atlassian. All rights reserved.