Package de.theit.jenkins.crowd
Class CrowdConfigurationService
java.lang.Object
de.theit.jenkins.crowd.CrowdConfigurationService
This class contains all objects that are necessary to access the REST
services on the remote Crowd server. Additionally it contains some helper
methods to check for group membership and availability.
- Since:
- 08.09.2011
- Version:
- $Id$
- Author:
- Thorsten Heit (theit@gmx.de)
-
Constructor Summary
ConstructorsConstructorDescriptionCrowdConfigurationService(String url, String applicationName, Secret password, int sessionValidationInterval, boolean useSSO, String cookieDomain, String cookieTokenkey, Boolean useProxy, String httpProxyHost, String httpProxyPort, String httpProxyUsername, Secret httpProxyPassword, String socketTimeout, String httpTimeout, String httpMaxConnections, boolean useCache, Integer cacheSize, Integer cacheTTL, String pGroupNames, boolean pNestedGroups) Creates a new Crowd configuration object. -
Method Summary
Modifier and TypeMethodDescriptioncom.atlassian.crowd.model.user.Userauthenticate(javax.servlet.http.HttpServletRequest httpServletRequest, javax.servlet.http.HttpServletResponse httpServletResponse, String name, String credentials) com.atlassian.crowd.model.user.UserauthenticateUser(String login, String password) com.atlassian.crowd.model.user.UserfindUserFromSSOToken(String token) Collection<org.springframework.security.core.GrantedAuthority>getAuthoritiesForUser(String username) Retrieves the list of all (nested) groups from the Crowd server that the user is a member of.getCrowdToken(javax.servlet.http.HttpServletRequest httpServletRequest) com.atlassian.crowd.model.group.GroupList<com.atlassian.crowd.model.group.Group>getGroupsForNestedUser(String username, int start, int size) List<com.atlassian.crowd.model.group.Group>getGroupsForUser(String username, int start, int size) com.atlassian.crowd.model.user.UserList<com.atlassian.crowd.model.authentication.ValidationFactor>getValidationFactors(javax.servlet.http.HttpServletRequest request) booleanisAuthenticated(javax.servlet.http.HttpServletRequest httpServletRequest, javax.servlet.http.HttpServletResponse httpServletResponse) booleanisGroupActive(String groupName) Checks if the specified group name exists on the remote Crowd server and is active.booleanisGroupMember(String username) Checks whether the user is a member of one of the Crowd groups whose members are allowed to login.booleanisUserDirectGroupMember(String username, String groupname) booleanisUserNestedGroupMember(String username, String groupname) booleanisUseSSO()voidlogout(javax.servlet.http.HttpServletRequest httpServletRequest, javax.servlet.http.HttpServletResponse httpServletResponse) voidshutdown()voidvoidvalidateSSOAuthentication(String token, List<com.atlassian.crowd.model.authentication.ValidationFactor> list)
-
Constructor Details
-
CrowdConfigurationService
public CrowdConfigurationService(String url, String applicationName, Secret password, int sessionValidationInterval, boolean useSSO, String cookieDomain, String cookieTokenkey, Boolean useProxy, String httpProxyHost, String httpProxyPort, String httpProxyUsername, Secret httpProxyPassword, String socketTimeout, String httpTimeout, String httpMaxConnections, boolean useCache, Integer cacheSize, Integer cacheTTL, String pGroupNames, boolean pNestedGroups) Creates a new Crowd configuration object.- Parameters:
url- The Crowd URLapplicationName- The Crowd application namepassword- The Crowd application passwordsessionValidationInterval- The session validation intervaluseSSO- Specifies if SSO should be enabledcookieDomain- The cookie domaincookieTokenkey- The cookie token keyuseProxy- the Specifies if a proxy should be usedhttpProxyHost- The http proxy hosthttpProxyPort- The http proxy porthttpProxyUsername- The http proxy usernamehttpProxyPassword- The http proxy passwordsocketTimeout- The socket timeouthttpTimeout- The http timeouthttpMaxConnections- The http max connectionsuseCache- The use cachecacheSize- the cache sizecacheTTL- The cache TTLpGroupNames- The group names to use when authenticating Crowd users. May not benull.pNestedGroups- Specifies whether nested groups should be used when validating users against a group name.
-
-
Method Details
-
getAllowedGroupNames
-
isUseSSO
public boolean isUseSSO() -
isGroupMember
Checks whether the user is a member of one of the Crowd groups whose members are allowed to login.- Parameters:
username- The name of the user to check. May not benullor empty.- Returns:
trueif and only if the group exists, is active and the user is either a direct group member or, if nested groups may be used, a nested group member.falseelse.
-
isGroupActive
public boolean isGroupActive(String groupName) throws com.atlassian.crowd.exception.InvalidAuthenticationException, com.atlassian.crowd.exception.ApplicationPermissionException, com.atlassian.crowd.exception.OperationFailedException Checks if the specified group name exists on the remote Crowd server and is active.- Parameters:
groupName- The name of the group to check. May not benullor empty.- Returns:
trueif and only if the group name is not empty, does exist on the remote Crowd server and is active.falseelse.- Throws:
com.atlassian.crowd.exception.InvalidAuthenticationException- If the application and password are not valid.com.atlassian.crowd.exception.ApplicationPermissionException- If the application is not permitted to perform the requested operation on the servercom.atlassian.crowd.exception.OperationFailedException- If the operation has failed for any other reason, including invalid arguments and the operation not being supported on the server.
-
getAuthoritiesForUser
public Collection<org.springframework.security.core.GrantedAuthority> getAuthoritiesForUser(String username) Retrieves the list of all (nested) groups from the Crowd server that the user is a member of.- Parameters:
username- The name of the user. May not benull.- Returns:
- The list of all groups that the user is a member of. Always non-null.
-
authenticateUser
public com.atlassian.crowd.model.user.User authenticateUser(String login, String password) throws com.atlassian.crowd.exception.UserNotFoundException, com.atlassian.crowd.exception.InactiveAccountException, com.atlassian.crowd.exception.ExpiredCredentialException, com.atlassian.crowd.exception.ApplicationPermissionException, com.atlassian.crowd.exception.InvalidAuthenticationException, com.atlassian.crowd.exception.OperationFailedException - Throws:
com.atlassian.crowd.exception.UserNotFoundExceptioncom.atlassian.crowd.exception.InactiveAccountExceptioncom.atlassian.crowd.exception.ExpiredCredentialExceptioncom.atlassian.crowd.exception.ApplicationPermissionExceptioncom.atlassian.crowd.exception.InvalidAuthenticationExceptioncom.atlassian.crowd.exception.OperationFailedException
-
getUser
public com.atlassian.crowd.model.user.User getUser(String username) throws com.atlassian.crowd.exception.UserNotFoundException, com.atlassian.crowd.exception.OperationFailedException, com.atlassian.crowd.exception.ApplicationPermissionException, com.atlassian.crowd.exception.InvalidAuthenticationException - Throws:
com.atlassian.crowd.exception.UserNotFoundExceptioncom.atlassian.crowd.exception.OperationFailedExceptioncom.atlassian.crowd.exception.ApplicationPermissionExceptioncom.atlassian.crowd.exception.InvalidAuthenticationException
-
getGroup
public com.atlassian.crowd.model.group.Group getGroup(String name) throws com.atlassian.crowd.exception.GroupNotFoundException, com.atlassian.crowd.exception.OperationFailedException, com.atlassian.crowd.exception.InvalidAuthenticationException, com.atlassian.crowd.exception.ApplicationPermissionException - Throws:
com.atlassian.crowd.exception.GroupNotFoundExceptioncom.atlassian.crowd.exception.OperationFailedExceptioncom.atlassian.crowd.exception.InvalidAuthenticationExceptioncom.atlassian.crowd.exception.ApplicationPermissionException
-
getGroupsForNestedUser
public List<com.atlassian.crowd.model.group.Group> getGroupsForNestedUser(String username, int start, int size) throws com.atlassian.crowd.exception.OperationFailedException, com.atlassian.crowd.exception.InvalidAuthenticationException, com.atlassian.crowd.exception.ApplicationPermissionException, com.atlassian.crowd.exception.UserNotFoundException - Throws:
com.atlassian.crowd.exception.OperationFailedExceptioncom.atlassian.crowd.exception.InvalidAuthenticationExceptioncom.atlassian.crowd.exception.ApplicationPermissionExceptioncom.atlassian.crowd.exception.UserNotFoundException
-
getGroupsForUser
public List<com.atlassian.crowd.model.group.Group> getGroupsForUser(String username, int start, int size) throws com.atlassian.crowd.exception.OperationFailedException, com.atlassian.crowd.exception.InvalidAuthenticationException, com.atlassian.crowd.exception.ApplicationPermissionException, com.atlassian.crowd.exception.UserNotFoundException - Throws:
com.atlassian.crowd.exception.OperationFailedExceptioncom.atlassian.crowd.exception.InvalidAuthenticationExceptioncom.atlassian.crowd.exception.ApplicationPermissionExceptioncom.atlassian.crowd.exception.UserNotFoundException
-
isUserDirectGroupMember
public boolean isUserDirectGroupMember(String username, String groupname) throws com.atlassian.crowd.exception.OperationFailedException, com.atlassian.crowd.exception.ApplicationPermissionException, com.atlassian.crowd.exception.InvalidAuthenticationException - Throws:
com.atlassian.crowd.exception.OperationFailedExceptioncom.atlassian.crowd.exception.ApplicationPermissionExceptioncom.atlassian.crowd.exception.InvalidAuthenticationException
-
isUserNestedGroupMember
public boolean isUserNestedGroupMember(String username, String groupname) throws com.atlassian.crowd.exception.OperationFailedException, com.atlassian.crowd.exception.ApplicationPermissionException, com.atlassian.crowd.exception.InvalidAuthenticationException - Throws:
com.atlassian.crowd.exception.OperationFailedExceptioncom.atlassian.crowd.exception.ApplicationPermissionExceptioncom.atlassian.crowd.exception.InvalidAuthenticationException
-
validateSSOAuthentication
public void validateSSOAuthentication(String token, List<com.atlassian.crowd.model.authentication.ValidationFactor> list) throws com.atlassian.crowd.exception.OperationFailedException, com.atlassian.crowd.exception.InvalidAuthenticationException, com.atlassian.crowd.exception.ApplicationPermissionException, com.atlassian.crowd.exception.InvalidTokenException - Throws:
com.atlassian.crowd.exception.OperationFailedExceptioncom.atlassian.crowd.exception.InvalidAuthenticationExceptioncom.atlassian.crowd.exception.ApplicationPermissionExceptioncom.atlassian.crowd.exception.InvalidTokenException
-
findUserFromSSOToken
public com.atlassian.crowd.model.user.User findUserFromSSOToken(String token) throws com.atlassian.crowd.exception.OperationFailedException, com.atlassian.crowd.exception.InvalidAuthenticationException, com.atlassian.crowd.exception.ApplicationPermissionException, com.atlassian.crowd.exception.InvalidTokenException - Throws:
com.atlassian.crowd.exception.OperationFailedExceptioncom.atlassian.crowd.exception.InvalidAuthenticationExceptioncom.atlassian.crowd.exception.ApplicationPermissionExceptioncom.atlassian.crowd.exception.InvalidTokenException
-
shutdown
public void shutdown() -
testConnection
public void testConnection() throws com.atlassian.crowd.exception.OperationFailedException, com.atlassian.crowd.exception.InvalidAuthenticationException, com.atlassian.crowd.exception.ApplicationPermissionException- Throws:
com.atlassian.crowd.exception.OperationFailedExceptioncom.atlassian.crowd.exception.InvalidAuthenticationExceptioncom.atlassian.crowd.exception.ApplicationPermissionException
-
getCrowdToken
-
getValidationFactors
public List<com.atlassian.crowd.model.authentication.ValidationFactor> getValidationFactors(javax.servlet.http.HttpServletRequest request) -
logout
public void logout(javax.servlet.http.HttpServletRequest httpServletRequest, javax.servlet.http.HttpServletResponse httpServletResponse) throws com.atlassian.crowd.exception.ApplicationPermissionException, com.atlassian.crowd.exception.InvalidAuthenticationException, com.atlassian.crowd.exception.OperationFailedException - Throws:
com.atlassian.crowd.exception.ApplicationPermissionExceptioncom.atlassian.crowd.exception.InvalidAuthenticationExceptioncom.atlassian.crowd.exception.OperationFailedException
-
authenticate
public com.atlassian.crowd.model.user.User authenticate(javax.servlet.http.HttpServletRequest httpServletRequest, javax.servlet.http.HttpServletResponse httpServletResponse, String name, String credentials) throws com.atlassian.crowd.exception.ApplicationPermissionException, com.atlassian.crowd.exception.InvalidAuthenticationException, com.atlassian.crowd.exception.OperationFailedException, com.atlassian.crowd.exception.ApplicationAccessDeniedException, com.atlassian.crowd.exception.ExpiredCredentialException, com.atlassian.crowd.exception.InactiveAccountException, com.atlassian.crowd.exception.InvalidTokenException - Throws:
com.atlassian.crowd.exception.ApplicationPermissionExceptioncom.atlassian.crowd.exception.InvalidAuthenticationExceptioncom.atlassian.crowd.exception.OperationFailedExceptioncom.atlassian.crowd.exception.ApplicationAccessDeniedExceptioncom.atlassian.crowd.exception.ExpiredCredentialExceptioncom.atlassian.crowd.exception.InactiveAccountExceptioncom.atlassian.crowd.exception.InvalidTokenException
-
isAuthenticated
public boolean isAuthenticated(javax.servlet.http.HttpServletRequest httpServletRequest, javax.servlet.http.HttpServletResponse httpServletResponse) throws com.atlassian.crowd.exception.OperationFailedException - Throws:
com.atlassian.crowd.exception.OperationFailedException
-