Class Cas2Authenticator
- java.lang.Object
-
- org.nuxeo.ecm.platform.ui.web.auth.cas2.Cas2Authenticator
-
- All Implemented Interfaces:
LoginResponseHandler
,NuxeoAuthenticationPlugin
,NuxeoAuthenticationPluginLogoutExtension
public class Cas2Authenticator extends Object implements NuxeoAuthenticationPlugin, NuxeoAuthenticationPluginLogoutExtension, LoginResponseHandler
- Author:
- Thierry Delprat, Olivier Adam, M.-A. Darche, Benjamin Jalon, Thierry Martins
-
-
Field Summary
Fields Modifier and Type Field Description protected static String
ALTERNATIVE_AUTH_PLUGIN_COOKIE_NAME
protected String
appURL
protected static String
CAS_SERVER_HEADER_KEY
protected static String
CAS_SERVER_PATTERN_KEY
protected String
defaultCasServer
protected String
errorPage
protected static String
EXCLUDE_PROMPT_KEY
protected List<String>
excludePromptURLs
protected static Log
log
protected static String
LOGIN_ACTION
protected static String
LOGOUT_ACTION
protected String
logoutURL
protected static String
NUXEO_SERVER_PATTERN_KEY
protected boolean
promptLogin
protected static String
PROXY_VALIDATE_ACTION
protected String
proxyKey
protected String
proxyValidateURL
We tell the CAS server whether we want a plain text (CAS 1.0) or XML (CAS 2.0) response by making the request either to the '.../validate' or '.../serviceValidate' URL.protected String
proxyValidatorClassName
protected boolean
serverHeaderEnabled
protected String
serviceKey
protected String
serviceLoginURL
protected String
serviceValidateURL
protected String
ticketKey
protected String
ticketValidatorClassName
protected static String
VALIDATE_ACTION
-
Constructor Summary
Constructors Constructor Description Cas2Authenticator()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description protected String
checkCasTicket(String ticket, javax.servlet.http.HttpServletRequest httpRequest)
protected String
checkProxyCasTicket(String ticket, javax.servlet.http.HttpServletRequest httpRequest)
protected NuxeoAuthenticationPlugin
getAlternativeAuthPlugin(javax.servlet.http.HttpServletRequest httpRequest, javax.servlet.http.HttpServletResponse httpResponse)
protected String
getAppURL(javax.servlet.http.HttpServletRequest httpRequest)
protected javax.servlet.http.Cookie
getCookie(javax.servlet.http.HttpServletRequest httpRequest, String cookieName)
protected String
getServiceURL(javax.servlet.http.HttpServletRequest httpRequest, String action)
List<String>
getUnAuthenticatedURLPrefix()
Returns the list of prefix for unauthenticated URLs, typically the URLs associated to login prompt.Boolean
handleLoginPrompt(javax.servlet.http.HttpServletRequest httpRequest, javax.servlet.http.HttpServletResponse httpResponse, String baseURL)
Handles the Login Prompt.Boolean
handleLogout(javax.servlet.http.HttpServletRequest httpRequest, javax.servlet.http.HttpServletResponse httpResponse)
Handles logout operation.UserIdentificationInfo
handleRetrieveIdentity(javax.servlet.http.HttpServletRequest httpRequest, javax.servlet.http.HttpServletResponse httpResponse)
Retrieves user identification information from the request.void
initPlugin(Map<String,String> parameters)
Initializes the Plugin from parameters set in the XML descriptor.Boolean
needLoginPrompt(javax.servlet.http.HttpServletRequest httpRequest)
Defines if the authentication plugin needs to do a login prompt.boolean
onError(javax.servlet.http.HttpServletRequest request, javax.servlet.http.HttpServletResponse response)
Handles the login error response.boolean
onSuccess(javax.servlet.http.HttpServletRequest arg0, javax.servlet.http.HttpServletResponse arg1)
Handles login success response.protected void
removeCookie(javax.servlet.http.HttpServletRequest httpRequest, javax.servlet.http.HttpServletResponse httpResponse, javax.servlet.http.Cookie cookie)
-
-
-
Field Detail
-
CAS_SERVER_HEADER_KEY
protected static final String CAS_SERVER_HEADER_KEY
- See Also:
- Constant Field Values
-
CAS_SERVER_PATTERN_KEY
protected static final String CAS_SERVER_PATTERN_KEY
- See Also:
- Constant Field Values
-
NUXEO_SERVER_PATTERN_KEY
protected static final String NUXEO_SERVER_PATTERN_KEY
- See Also:
- Constant Field Values
-
LOGIN_ACTION
protected static final String LOGIN_ACTION
- See Also:
- Constant Field Values
-
LOGOUT_ACTION
protected static final String LOGOUT_ACTION
- See Also:
- Constant Field Values
-
VALIDATE_ACTION
protected static final String VALIDATE_ACTION
- See Also:
- Constant Field Values
-
PROXY_VALIDATE_ACTION
protected static final String PROXY_VALIDATE_ACTION
- See Also:
- Constant Field Values
-
log
protected static final Log log
-
EXCLUDE_PROMPT_KEY
protected static final String EXCLUDE_PROMPT_KEY
- See Also:
- Constant Field Values
-
ALTERNATIVE_AUTH_PLUGIN_COOKIE_NAME
protected static final String ALTERNATIVE_AUTH_PLUGIN_COOKIE_NAME
- See Also:
- Constant Field Values
-
ticketKey
protected String ticketKey
-
proxyKey
protected String proxyKey
-
appURL
protected String appURL
-
serviceLoginURL
protected String serviceLoginURL
-
serviceValidateURL
protected String serviceValidateURL
-
proxyValidateURL
protected String proxyValidateURL
We tell the CAS server whether we want a plain text (CAS 1.0) or XML (CAS 2.0) response by making the request either to the '.../validate' or '.../serviceValidate' URL. The older protocol supports only the CAS 1.0 functionality, which is left around as the legacy '.../validate' URL.
-
serviceKey
protected String serviceKey
-
logoutURL
protected String logoutURL
-
defaultCasServer
protected String defaultCasServer
-
serverHeaderEnabled
protected boolean serverHeaderEnabled
-
ticketValidatorClassName
protected String ticketValidatorClassName
-
proxyValidatorClassName
protected String proxyValidatorClassName
-
promptLogin
protected boolean promptLogin
-
errorPage
protected String errorPage
-
-
Method Detail
-
getUnAuthenticatedURLPrefix
public List<String> getUnAuthenticatedURLPrefix()
Description copied from interface:NuxeoAuthenticationPlugin
Returns the list of prefix for unauthenticated URLs, typically the URLs associated to login prompt.- Specified by:
getUnAuthenticatedURLPrefix
in interfaceNuxeoAuthenticationPlugin
-
getServiceURL
protected String getServiceURL(javax.servlet.http.HttpServletRequest httpRequest, String action)
-
handleLoginPrompt
public Boolean handleLoginPrompt(javax.servlet.http.HttpServletRequest httpRequest, javax.servlet.http.HttpServletResponse httpResponse, String baseURL)
Description copied from interface:NuxeoAuthenticationPlugin
Handles the Login Prompt.- Specified by:
handleLoginPrompt
in interfaceNuxeoAuthenticationPlugin
- Parameters:
httpRequest
- the requesthttpResponse
- the response- Returns:
- true if AuthFilter must stop execution (ie: login prompt generated a redirect), false otherwise
-
getAppURL
protected String getAppURL(javax.servlet.http.HttpServletRequest httpRequest)
-
handleRetrieveIdentity
public UserIdentificationInfo handleRetrieveIdentity(javax.servlet.http.HttpServletRequest httpRequest, javax.servlet.http.HttpServletResponse httpResponse)
Description copied from interface:NuxeoAuthenticationPlugin
Retrieves user identification information from the request.- Specified by:
handleRetrieveIdentity
in interfaceNuxeoAuthenticationPlugin
- Parameters:
httpRequest
- the requesthttpResponse
- the response
-
initPlugin
public void initPlugin(Map<String,String> parameters)
Description copied from interface:NuxeoAuthenticationPlugin
Initializes the Plugin from parameters set in the XML descriptor.- Specified by:
initPlugin
in interfaceNuxeoAuthenticationPlugin
-
needLoginPrompt
public Boolean needLoginPrompt(javax.servlet.http.HttpServletRequest httpRequest)
Description copied from interface:NuxeoAuthenticationPlugin
Defines if the authentication plugin needs to do a login prompt.- Specified by:
needLoginPrompt
in interfaceNuxeoAuthenticationPlugin
- Returns:
- true if LoginPrompt is used
-
handleLogout
public Boolean handleLogout(javax.servlet.http.HttpServletRequest httpRequest, javax.servlet.http.HttpServletResponse httpResponse)
Description copied from interface:NuxeoAuthenticationPluginLogoutExtension
Handles logout operation.Generic logout (killing session and Seam objects) is done by LogoutActionBean This interface must be implemented by auth plugin when the target auth system needs a specific logout procedure.
- Specified by:
handleLogout
in interfaceNuxeoAuthenticationPluginLogoutExtension
- Returns:
- true if caller must stop execution (ie: logout generated a redirect), false otherwise
-
checkProxyCasTicket
protected String checkProxyCasTicket(String ticket, javax.servlet.http.HttpServletRequest httpRequest)
-
checkCasTicket
protected String checkCasTicket(String ticket, javax.servlet.http.HttpServletRequest httpRequest)
-
onError
public boolean onError(javax.servlet.http.HttpServletRequest request, javax.servlet.http.HttpServletResponse response)
Description copied from interface:LoginResponseHandler
Handles the login error response.- Specified by:
onError
in interfaceLoginResponseHandler
- Parameters:
request
- the HTTP requestresponse
- the HTTP response- Returns:
- true if error was handled, false otherwise
-
onSuccess
public boolean onSuccess(javax.servlet.http.HttpServletRequest arg0, javax.servlet.http.HttpServletResponse arg1)
Description copied from interface:LoginResponseHandler
Handles login success response.- Specified by:
onSuccess
in interfaceLoginResponseHandler
- Parameters:
arg0
- the HTTP requestarg1
- the HTTP response- Returns:
- true if response was handled, false otherwise
-
getAlternativeAuthPlugin
protected NuxeoAuthenticationPlugin getAlternativeAuthPlugin(javax.servlet.http.HttpServletRequest httpRequest, javax.servlet.http.HttpServletResponse httpResponse)
-
getCookie
protected javax.servlet.http.Cookie getCookie(javax.servlet.http.HttpServletRequest httpRequest, String cookieName)
-
removeCookie
protected void removeCookie(javax.servlet.http.HttpServletRequest httpRequest, javax.servlet.http.HttpServletResponse httpResponse, javax.servlet.http.Cookie cookie)
-
-