com.atlassian.crowd.integration.jive
Class CrowdAuthFactory

java.lang.Object
  extended by com.jivesoftware.base.AuthFactory
      extended by com.atlassian.crowd.integration.jive.CrowdAuthFactory

public class CrowdAuthFactory
extends com.jivesoftware.base.AuthFactory

CrowdAuthFactory implements SSO to Jive. This allows users that are authenticated with Crowd to be automatically authenticated with Jive.

Also, if an unauthenticated user logs in via Jive, they are authenticated to Crowd.

If a user logs out via Jive, the users are logged out of Crowd.

Users (principals) cannot be created via Jive. They may be unable to authenticate with Crowd, and hence Jive. All users that need to authenticate with Jive MUST be in the groups/directories allowed to authenticate with Jive application. This is set up in the Crowd Console.


Field Summary
 
Fields inherited from class com.jivesoftware.base.AuthFactory
cipher, COOKIE_AUTOLOGIN, COOKIE_JIVE_SERVER_INFO, COOKIE_LOGGED_IN, SESSION_AUTHORIZATION
 
Constructor Summary
CrowdAuthFactory()
           
CrowdAuthFactory(HttpAuthenticator httpAuthenticator)
           
 
Method Summary
protected  void clearSessionUserInfo(javax.servlet.http.HttpServletRequest request, javax.servlet.http.HttpServletResponse response)
          Logs out of Jive and Crowd.
 com.jivesoftware.base.AuthToken createAnonymousAuthToken()
           
protected  com.jivesoftware.base.AuthToken createAuthToken(javax.servlet.http.HttpServletRequest request, javax.servlet.http.HttpServletResponse response)
          Create an AuthToken based on servlet request and response parameters.
 com.jivesoftware.base.AuthToken createAuthToken(java.lang.String username, java.lang.String password)
          Create a temporary AuthToken for non-SSO authentication.
protected  com.jivesoftware.base.AuthToken createSessionUserInfo(java.lang.String username, java.lang.String password, boolean autoLogin, javax.servlet.http.HttpServletRequest request, javax.servlet.http.HttpServletResponse response)
           
 
Methods inherited from class com.jivesoftware.base.AuthFactory
addServerInfoCookie, checkAuthorization, checkIfBanned, decryptAuthInfo, encryptAuthInfo, forceReload, getAnonymousAuthToken, getAuthToken, getAuthToken, getServerInfoCookieProperty, loginUser, logoutUser
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

CrowdAuthFactory

public CrowdAuthFactory(HttpAuthenticator httpAuthenticator)

CrowdAuthFactory

public CrowdAuthFactory()
Method Detail

createAuthToken

protected com.jivesoftware.base.AuthToken createAuthToken(javax.servlet.http.HttpServletRequest request,
                                                          javax.servlet.http.HttpServletResponse response)
                                                   throws com.jivesoftware.base.UnauthorizedException
Create an AuthToken based on servlet request and response parameters. This method hooks into Crowd's authenticator to implement SSO.

If the request is authenticated via Crowd and the request has an associated session with Jive (and the Crowd principal matches the session's Jive principal), the session's Jive authToken is returned.

Else we will try and authenticate the user with Crowd based on the username and password parameters present in the request.

If the request is authenticated via Crowd and a Jive session doesn't exist, or exists for a different principal, the Crowd principal is authenticated with Jive.

If all of the above methods fail, an an UnauthorizedException is thrown.

Overrides:
createAuthToken in class com.jivesoftware.base.AuthFactory
Parameters:
request - servlet request (may contain Crowds token cookie, Jive's associated session)
response - servlet response
Returns:
generated or session-stored AuthToken
Throws:
com.jivesoftware.base.UnauthorizedException

createSessionUserInfo

protected com.jivesoftware.base.AuthToken createSessionUserInfo(java.lang.String username,
                                                                java.lang.String password,
                                                                boolean autoLogin,
                                                                javax.servlet.http.HttpServletRequest request,
                                                                javax.servlet.http.HttpServletResponse response)
                                                         throws com.jivesoftware.base.UnauthorizedException
Overrides:
createSessionUserInfo in class com.jivesoftware.base.AuthFactory
Throws:
com.jivesoftware.base.UnauthorizedException

clearSessionUserInfo

protected void clearSessionUserInfo(javax.servlet.http.HttpServletRequest request,
                                    javax.servlet.http.HttpServletResponse response)
Logs out of Jive and Crowd. Clears associated session/cookie data.

Overrides:
clearSessionUserInfo in class com.jivesoftware.base.AuthFactory
Parameters:
request - servlet request.
response - servlet response.

createAuthToken

public com.jivesoftware.base.AuthToken createAuthToken(java.lang.String username,
                                                       java.lang.String password)
                                                throws com.jivesoftware.base.UnauthorizedException
Create a temporary AuthToken for non-SSO authentication. This is used to authenticate webservice-based calls.

Specified by:
createAuthToken in class com.jivesoftware.base.AuthFactory
Parameters:
username - username of user.
password - password of user.
Returns:
authentication token formed by the username and userID.
Throws:
com.jivesoftware.base.UnauthorizedException - if the authentication is invalid.

createAnonymousAuthToken

public com.jivesoftware.base.AuthToken createAnonymousAuthToken()
Specified by:
createAnonymousAuthToken in class com.jivesoftware.base.AuthFactory


Copyright © 2009 Atlassian Pty Ltd. All Rights Reserved.