From b9c664e0eed00ea2d285db412e36dc713fb0c75d Mon Sep 17 00:00:00 2001 From: Jan Vonka Date: Mon, 22 Dec 2008 16:42:39 +0000 Subject: [PATCH] Merged V3.0 to HEAD 12349: Tweaked the Hibernate session helper to prevent initially-large sessions from drowning the flush code 12452: MT - fix ETHREEOH-1056 12453: MT - fix ETHREEOH-886 12460: MT - fix ETHREEOH-1013 git-svn-id: https://svn.alfresco.com/repos/alfresco-enterprise/alfresco/HEAD/root@12536 c4b6b30b-aa2e-2d43-bbcb-ca4b014f7261 --- .../MTWebScriptAuthenticationFilter.java | 112 ------------------ source/web/WEB-INF/web.xml | 31 ----- 2 files changed, 143 deletions(-) delete mode 100644 source/java/org/alfresco/web/app/servlet/MTWebScriptAuthenticationFilter.java diff --git a/source/java/org/alfresco/web/app/servlet/MTWebScriptAuthenticationFilter.java b/source/java/org/alfresco/web/app/servlet/MTWebScriptAuthenticationFilter.java deleted file mode 100644 index 207da11f0a..0000000000 --- a/source/java/org/alfresco/web/app/servlet/MTWebScriptAuthenticationFilter.java +++ /dev/null @@ -1,112 +0,0 @@ -/* - * Copyright (C) 2005-2008 Alfresco Software Limited. - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the GNU General Public License - * as published by the Free Software Foundation; either version 2 - * of the License, or (at your option) any later version. - - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. - - * As a special exception to the terms and conditions of version 2.0 of - * the GPL, you may redistribute this Program in connection with Free/Libre - * and Open Source Software ("FLOSS") applications as described in Alfresco's - * FLOSS exception. You should have recieved a copy of the text describing - * the FLOSS exception, and it is also available here: - * http://www.alfresco.com/legal/licensing" - */ -package org.alfresco.web.app.servlet; - -import java.io.IOException; - -import javax.servlet.Filter; -import javax.servlet.FilterChain; -import javax.servlet.FilterConfig; -import javax.servlet.ServletException; -import javax.servlet.ServletRequest; -import javax.servlet.ServletResponse; -import javax.servlet.http.HttpServletRequest; -import javax.servlet.http.HttpServletResponse; - -import org.alfresco.repo.security.authentication.AuthenticationUtil; -import org.alfresco.web.scripts.Authenticator; -import org.alfresco.web.scripts.Description.RequiredAuthentication; -import org.alfresco.web.scripts.servlet.ServletAuthenticatorFactory; -import org.alfresco.web.scripts.servlet.WebScriptServletRequest; -import org.alfresco.web.scripts.servlet.WebScriptServletResponse; -import org.springframework.context.ApplicationContext; -import org.springframework.web.context.support.WebApplicationContextUtils; - -/** - * In case of MT-context, this servlet filter will force authentication prior to WebScript binding, even for WebScripts - * that do not require authentication. - * - * In future releases, consider updating the HTTP API such that an optional tenant context could be specified as part of - * the URL, hence not requiring pre-authentication in that case. - */ -public class MTWebScriptAuthenticationFilter implements Filter -{ - private FilterConfig config; - - private ApplicationContext appContext; - - /** - * @see javax.servlet.Filter#init(javax.servlet.FilterConfig) - */ - public void init(FilterConfig config) throws ServletException - { - this.config = config; - this.appContext = WebApplicationContextUtils.getRequiredWebApplicationContext(config.getServletContext()); - } - - /** - * @see javax.servlet.Filter#doFilter(javax.servlet.ServletRequest, javax.servlet.ServletResponse, javax.servlet.FilterChain) - */ - public void doFilter(ServletRequest req, ServletResponse res, FilterChain chain) - throws IOException, ServletException - { - if (AuthenticationUtil.isMtEnabled()) - { - String currentUser = AuthenticationUtil.getFullyAuthenticatedUser(); - if (currentUser == null) - { - // retrieve authenticator factory - String authenticatorId = config.getInitParameter("authenticator"); - if (authenticatorId != null && authenticatorId.length() > 0) - { - Object bean = appContext.getBean(authenticatorId); - if (bean == null || !(bean instanceof ServletAuthenticatorFactory)) - { - throw new ServletException("Initialisation parameter 'authenticator' does not refer to a servlet authenticator factory (" + authenticatorId + ")"); - } - - ServletAuthenticatorFactory authenticatorFactory = (ServletAuthenticatorFactory)bean; - - if ((req instanceof HttpServletRequest) && (res instanceof HttpServletResponse)) - { - Authenticator authenticator = authenticatorFactory.create(new WebScriptServletRequest(null, (HttpServletRequest)req, null, null), new WebScriptServletResponse(null, (HttpServletResponse)res)); - authenticator.authenticate(RequiredAuthentication.user, false); - } - } - } - } - - // continue filter chaining - chain.doFilter(req, res); - } - - /** - * @see javax.servlet.Filter#destroy() - */ - public void destroy() - { - // nothing to do - } -} diff --git a/source/web/WEB-INF/web.xml b/source/web/WEB-INF/web.xml index 83fa7f6449..e4c34a5240 100644 --- a/source/web/WEB-INF/web.xml +++ b/source/web/WEB-INF/web.xml @@ -123,23 +123,6 @@ org.alfresco.web.app.servlet.AdminAuthenticationFilter - - MT WebScript Basic Authentication Filter - org.alfresco.web.app.servlet.MTWebScriptAuthenticationFilter - - authenticator - webscripts.authenticator.basic - - - - - MT WebScript WC Authentication Filter - org.alfresco.web.app.servlet.MTWebScriptAuthenticationFilter - - authenticator - webscripts.authenticator.webclient - - @@ -241,20 +224,6 @@ - - - - MT WebScript Basic Authentication Filter - apiServlet - - - - MT WebScript WC Authentication Filter - wcapiServlet - - - org.apache.myfaces.webapp.StartupServletContextListener