diff --git a/source/java/org/alfresco/repo/web/scripts/RepositoryContainer.java b/source/java/org/alfresco/repo/web/scripts/RepositoryContainer.java index c17bc3687a..65afd47e8e 100644 --- a/source/java/org/alfresco/repo/web/scripts/RepositoryContainer.java +++ b/source/java/org/alfresco/repo/web/scripts/RepositoryContainer.java @@ -681,7 +681,22 @@ public class RepositoryContainer extends AbstractRuntimeContainer implements Ten */ public void destroy() { - webScriptsRegistryCache.remove(tenantAdminService.getCurrentUserDomain()); + try + { + webScriptsRegistryLock.writeLock().lock(); + webScriptsRegistryCache.remove(tenantAdminService.getCurrentUserDomain()); + + if (logger.isTraceEnabled()) + { + Exception e = new Exception("RepositoryContainer destroy called."); + e.fillInStackTrace(); + logger.trace("", e); + } + } + finally + { + webScriptsRegistryLock.writeLock().unlock(); + } initialized = false; } diff --git a/source/java/org/alfresco/repo/web/scripts/RepositoryContainerTest.java b/source/java/org/alfresco/repo/web/scripts/RepositoryContainerTest.java index 93becff222..06d98d8857 100644 --- a/source/java/org/alfresco/repo/web/scripts/RepositoryContainerTest.java +++ b/source/java/org/alfresco/repo/web/scripts/RepositoryContainerTest.java @@ -23,8 +23,6 @@ import org.alfresco.repo.security.authentication.AuthenticationUtil; import org.alfresco.service.cmr.security.MutableAuthenticationService; import org.alfresco.service.cmr.security.PersonService; import org.alfresco.util.PropertyMap; -import org.springframework.extensions.webscripts.TestWebScriptServer.GetRequest; -import org.springframework.extensions.webscripts.TestWebScriptServer.Response; /** * Unit test to test runas function @@ -38,8 +36,6 @@ public class RepositoryContainerTest extends BaseWebScriptTest private static final String USER_ONE = "RunAsOne"; - private static final String URL_RUNAS = "/test/runas"; - @Override protected void setUp() throws Exception { @@ -79,11 +75,9 @@ public class RepositoryContainerTest extends BaseWebScriptTest super.tearDown(); } - public void testRunAs() throws Exception + public void testReset() throws Exception { - // TODO: this test needs refactoring after SpringSurf changes - //Response response = sendRequest(new GetRequest(URL_RUNAS), 200, AuthenticationUtil.getAdminUserName()); - //assertEquals(USER_ONE, response.getContentAsString()); - assertTrue(true); + RepositoryContainer repoContainer = (RepositoryContainer) getServer().getApplicationContext().getBean("webscripts.container"); + repoContainer.reset(); } } diff --git a/source/java/org/alfresco/repo/webdav/auth/BaseKerberosAuthenticationFilter.java b/source/java/org/alfresco/repo/webdav/auth/BaseKerberosAuthenticationFilter.java index 477c62782c..2c4bdc0b14 100644 --- a/source/java/org/alfresco/repo/webdav/auth/BaseKerberosAuthenticationFilter.java +++ b/source/java/org/alfresco/repo/webdav/auth/BaseKerberosAuthenticationFilter.java @@ -1,19 +1,19 @@ /* - * Copyright (C) 2005-2010 Alfresco Software Limited. - * - * This file is part of Alfresco - * - * Alfresco is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * Alfresco 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 Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public License + * Copyright (C) 2005-2010 Alfresco Software Limited. + * + * This file is part of Alfresco + * + * Alfresco is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * Alfresco 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 Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public License * along with Alfresco. If not, see . */ @@ -334,8 +334,7 @@ public abstract class BaseKerberosAuthenticationFilter extends BaseSSOAuthentica req.getRemoteAddr() + ":" + req.getRemotePort() + ")"); // Send back a request for SPNEGO authentication - - restartLoginChallenge(context, req, resp); + logonStartAgain(context, req, resp); return false; } else @@ -588,12 +587,23 @@ public abstract class BaseKerberosAuthenticationFilter extends BaseSSOAuthentica { session.invalidate(); } + logonStartAgain(context, req, resp); + } + + /** + * The logon to start again + * + * @param resp HttpServletResponse + * @param httpSess HttpSession + * @throws IOException + */ + public void logonStartAgain(ServletContext context, HttpServletRequest req, HttpServletResponse resp) throws IOException + { // Force the logon to start again - resp.setHeader("WWW-Authenticate", "Negotiate"); resp.setStatus(HttpServletResponse.SC_UNAUTHORIZED); - writeLoginPageLink(req, resp); + writeLoginPageLink(req, resp); resp.flushBuffer(); }