Package org.alfresco.repo.webdav.auth
Class BaseAuthenticationFilter
java.lang.Object
org.alfresco.repo.webdav.auth.BaseAuthenticationFilter
- Direct Known Subclasses:
AuthenticationFilter,BaseSSOAuthenticationFilter,HTTPRequestAuthenticationFilter,WebscriptCookieAuthenticationFilter,WebScriptSSOAuthenticationFilter
A base class for authentication filters. Handles management of the session user.
- Author:
- dward
-
Field Summary
FieldsModifier and TypeFieldDescriptionprotected static final StringThe name of the ticket argument.static final StringThe default session attribute used to cache the user.protected AuthenticationComponentThe authentication component.protected AuthenticationListenerThe authentication listener.protected AuthenticationServiceThe authentication service.protected static final StringIndication by an up-stream filter that no authentication checks are required.protected NodeServiceThe node service.protected PersonServiceThe person service.protected RemoteUserMapperThe remote user mapper.protected TransactionServiceThe transaction service. -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprotected SessionUsercreateUserEnvironment(javax.servlet.http.HttpSession session, String userName) Callback to create the User environment as appropriate for a filter implprotected SessionUsercreateUserEnvironment(javax.servlet.http.HttpSession session, String userName, String ticket, boolean externalAuth) Callback to create the User environment as appropriate for a filter impl.protected SessionUsercreateUserObject(String userName, String ticket, NodeRef personNode, NodeRef homeSpaceRef) Create the user object that will be stored in the session.protected <T> TExecutes a callback in a transaction as the system userprotected abstract org.apache.commons.logging.LogReturn the logger.protected SessionUsergetSessionUser(javax.servlet.ServletContext servletContext, javax.servlet.http.HttpServletRequest httpServletRequest, javax.servlet.http.HttpServletResponse httpServletResponse, boolean externalAuth) Callback to get the specific impl of the Session User for a filter.protected final StringReturn the user object session attribute name.protected booleanhandleLoginForm(javax.servlet.http.HttpServletRequest req, javax.servlet.http.HttpServletResponse res) Handles the login form directly, allowing management of the session user.protected voidinvalidateSession(javax.servlet.http.HttpServletRequest req) Remove the user from the session and expire the session - after failed ticket auth.voidsetAuthenticationComponent(AuthenticationComponent authenticationComponent) Sets the authentication component.voidsetAuthenticationListener(AuthenticationListener authenticationListener) Sets the authentication listener.voidsetAuthenticationService(AuthenticationService authenticationService) Sets the authentication service.voidsetNodeService(NodeService nodeService) Sets the node service.voidsetPersonService(PersonService personService) Sets the person service.voidsetRemoteUserMapper(RemoteUserMapper remoteUserMapper) Sets the remote user mapper.voidsetTransactionService(TransactionService transactionService) Sets the transaction service.protected final voidsetUserAttributeName(String userAttr) Set the user object attribute name.
-
Field Details
-
NO_AUTH_REQUIRED
Indication by an up-stream filter that no authentication checks are required.- See Also:
-
AUTHENTICATION_USER
The default session attribute used to cache the user. Subclasses may override this withsetUserAttributeName(String).- See Also:
-
ARG_TICKET
The name of the ticket argument.- See Also:
-
authenticationService
The authentication service. -
personService
The person service. -
nodeService
The node service. -
transactionService
The transaction service. -
authenticationComponent
The authentication component. -
remoteUserMapper
The remote user mapper. -
authenticationListener
The authentication listener.
-
-
Constructor Details
-
BaseAuthenticationFilter
public BaseAuthenticationFilter()
-
-
Method Details
-
setAuthenticationService
Sets the authentication service.- Parameters:
authenticationService- the authService to set
-
setPersonService
Sets the person service.- Parameters:
personService- the personService to set
-
setNodeService
Sets the node service.- Parameters:
nodeService- the nodeService to set
-
setTransactionService
Sets the transaction service.- Parameters:
transactionService- the transactionService to set
-
setAuthenticationComponent
Sets the authentication component.- Parameters:
authenticationComponent- the authentication component
-
setAuthenticationListener
Sets the authentication listener.- Parameters:
authenticationListener- AuthenticationListener
-
setRemoteUserMapper
Sets the remote user mapper.- Parameters:
remoteUserMapper- the remote user mapper
-
createUserObject
protected SessionUser createUserObject(String userName, String ticket, NodeRef personNode, NodeRef homeSpaceRef) Create the user object that will be stored in the session.- Parameters:
userName- Stringticket- StringpersonNode- NodeRefhomeSpaceRef- NodeRef- Returns:
- SessionUser
-
getSessionUser
protected SessionUser getSessionUser(javax.servlet.ServletContext servletContext, javax.servlet.http.HttpServletRequest httpServletRequest, javax.servlet.http.HttpServletResponse httpServletResponse, boolean externalAuth) Callback to get the specific impl of the Session User for a filter.- Parameters:
servletContext- the servlet contexthttpServletRequest- the http servlet requesthttpServletResponse- the http servlet responseexternalAuth- has the user been authenticated by SSO?- Returns:
- User from the session
-
invalidateSession
protected void invalidateSession(javax.servlet.http.HttpServletRequest req) Remove the user from the session and expire the session - after failed ticket auth.- Parameters:
req- HttpServletRequest
-
doInSystemTransaction
protected <T> T doInSystemTransaction(RetryingTransactionHelper.RetryingTransactionCallback<T> callback) Executes a callback in a transaction as the system user- Parameters:
callback- the callback- Returns:
- the return value from the callback
-
getUserAttributeName
Return the user object session attribute name.- Returns:
- the user object session attribute name
-
setUserAttributeName
Set the user object attribute name.- Parameters:
userAttr- the user object session attribute name
-
createUserEnvironment
protected SessionUser createUserEnvironment(javax.servlet.http.HttpSession session, String userName, String ticket, boolean externalAuth) throws IOException, javax.servlet.ServletException Callback to create the User environment as appropriate for a filter impl.- Parameters:
session- HttpSessionuserName- Stringticket- the ticketexternalAuth- has the user been authenticated by SSO?- Returns:
- SessionUser
- Throws:
IOException- Signals that an I/O exception has occurred.javax.servlet.ServletException- the servlet exception
-
createUserEnvironment
protected SessionUser createUserEnvironment(javax.servlet.http.HttpSession session, String userName) throws IOException, javax.servlet.ServletException Callback to create the User environment as appropriate for a filter impl- Parameters:
session- HttpSessionuserName- String- Returns:
- SessionUser
- Throws:
IOExceptionjavax.servlet.ServletException
-
getLogger
protected abstract org.apache.commons.logging.Log getLogger()Return the logger.- Returns:
- Log
-
handleLoginForm
protected boolean handleLoginForm(javax.servlet.http.HttpServletRequest req, javax.servlet.http.HttpServletResponse res) throws IOException, javax.servlet.ServletException Handles the login form directly, allowing management of the session user.- Parameters:
req- the requestres- the response- Throws:
IOException- Signals that an I/O exception has occurred.javax.servlet.ServletException- on error
-