com.atlassian.crowd.integration.http.util
Class CrowdHttpTokenHelperImpl

java.lang.Object
  extended by com.atlassian.crowd.integration.http.util.CrowdHttpTokenHelperImpl
All Implemented Interfaces:
CrowdHttpTokenHelper

public class CrowdHttpTokenHelperImpl
extends Object
implements CrowdHttpTokenHelper

Helper class for Crowd SSO token operations.


Method Summary
 String getCrowdToken(javax.servlet.http.HttpServletRequest request, String tokenName)
          Retrieves the Crowd authentication token from the request either via:

a request attribute (not request parameter), OR a cookie on the request

static CrowdHttpTokenHelper getInstance(CrowdHttpValidationFactorExtractor validationFactorExtractor)
          Returns an instance of CrowdHttpTokenHelper.
 UserAuthenticationContext getUserAuthenticationContext(javax.servlet.http.HttpServletRequest request, String username, String password, ClientProperties clientProperties)
          Returns the user authentication context from a request.
 CrowdHttpValidationFactorExtractor getValidationFactorExtractor()
          Returns the ValidationFactor extractor.
 void removeCrowdToken(javax.servlet.http.HttpServletRequest request, javax.servlet.http.HttpServletResponse response, ClientProperties clientProperties, CookieConfiguration cookieConfig)
          Removes the Crowd SSO token.
 void setCrowdToken(javax.servlet.http.HttpServletRequest request, javax.servlet.http.HttpServletResponse response, String token, ClientProperties clientProperties, CookieConfiguration cookieConfig)
          Sets the Crowd SSO token in: the request: as an attribute, so the user is authenticated for the span of the request. the response: as a cookie, so the user is authenticated for subsequent requests. Also sets the last session validation date/time.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Method Detail

getCrowdToken

public String getCrowdToken(javax.servlet.http.HttpServletRequest request,
                            String tokenName)
Description copied from interface: CrowdHttpTokenHelper
Retrieves the Crowd authentication token from the request either via:

  1. a request attribute (not request parameter), OR
  2. a cookie on the request

Specified by:
getCrowdToken in interface CrowdHttpTokenHelper
Parameters:
request - request to look for the Crowd SSO token.
tokenName - name of the request attribute and cookie for the Crowd SSO token.
Returns:
value of the token if found, otherwise null.

removeCrowdToken

public void removeCrowdToken(javax.servlet.http.HttpServletRequest request,
                             javax.servlet.http.HttpServletResponse response,
                             ClientProperties clientProperties,
                             CookieConfiguration cookieConfig)
Description copied from interface: CrowdHttpTokenHelper
Removes the Crowd SSO token. Deletes the token cookie by session the cookie in the response to max age of 0; and removes the token attributes from the request.

Specified by:
removeCrowdToken in interface CrowdHttpTokenHelper
Parameters:
request - request to invalidate the client for.
response - response to invalidate the cookie for. Can be null.
clientProperties - properties of the client
cookieConfig - cookie configuration. Can be null if response is null since no cookie will be set.

setCrowdToken

public void setCrowdToken(javax.servlet.http.HttpServletRequest request,
                          javax.servlet.http.HttpServletResponse response,
                          String token,
                          ClientProperties clientProperties,
                          CookieConfiguration cookieConfig)
Description copied from interface: CrowdHttpTokenHelper
Sets the Crowd SSO token in:
  1. the request: as an attribute, so the user is authenticated for the span of the request.
  2. the response: as a cookie, so the user is authenticated for subsequent requests.
Also sets the last session validation date/time.

Specified by:
setCrowdToken in interface CrowdHttpTokenHelper
Parameters:
request - request to set the attribute and session attribute for.
response - response to set the cookie for. Can be null.
token - token value to use.
clientProperties - properties of the client
cookieConfig - Cookie configuration

getUserAuthenticationContext

public UserAuthenticationContext getUserAuthenticationContext(javax.servlet.http.HttpServletRequest request,
                                                              String username,
                                                              String password,
                                                              ClientProperties clientProperties)
Description copied from interface: CrowdHttpTokenHelper
Returns the user authentication context from a request.

Specified by:
getUserAuthenticationContext in interface CrowdHttpTokenHelper
Parameters:
request - HttpRequest object
username - user's name
password - user's password
clientProperties - properties of the client
Returns:
UserAuthenticationContext.

getValidationFactorExtractor

public CrowdHttpValidationFactorExtractor getValidationFactorExtractor()
Description copied from interface: CrowdHttpTokenHelper
Returns the ValidationFactor extractor.

Specified by:
getValidationFactorExtractor in interface CrowdHttpTokenHelper
Returns:
validation factor extractor

getInstance

public static CrowdHttpTokenHelper getInstance(CrowdHttpValidationFactorExtractor validationFactorExtractor)
Returns an instance of CrowdHttpTokenHelper.

Returns:
CrowdHttpTokenHelper.


Copyright © 2012 Atlassian. All Rights Reserved.