diff --git a/config/alfresco/cmis-ws-context.xml b/config/alfresco/cmis-ws-context.xml
index bedeb70be2..3be4072184 100644
--- a/config/alfresco/cmis-ws-context.xml
+++ b/config/alfresco/cmis-ws-context.xml
@@ -18,11 +18,13 @@
+
+
@@ -45,11 +47,13 @@
+
+
@@ -71,11 +75,13 @@
+
+
@@ -99,11 +105,13 @@
+
+
@@ -126,11 +134,13 @@
+
+
@@ -153,11 +163,13 @@
+
+
@@ -180,11 +192,13 @@
+
+
@@ -206,11 +220,13 @@
+
+
@@ -352,6 +368,11 @@
-
+
+
+
+
+
+
\ No newline at end of file
diff --git a/source/java/org/alfresco/repo/cmis/ws/AuthenticationClearInterceptor.java b/source/java/org/alfresco/repo/cmis/ws/AuthenticationClearInterceptor.java
new file mode 100644
index 0000000000..cc54d2939e
--- /dev/null
+++ b/source/java/org/alfresco/repo/cmis/ws/AuthenticationClearInterceptor.java
@@ -0,0 +1,54 @@
+/*
+ * 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.repo.cmis.ws;
+
+import org.alfresco.repo.security.authentication.AuthenticationUtil;
+import org.apache.cxf.binding.soap.SoapMessage;
+import org.apache.cxf.binding.soap.interceptor.AbstractSoapInterceptor;
+import org.apache.cxf.interceptor.Fault;
+import org.apache.cxf.phase.Phase;
+
+/**
+ * @author Dmitry Velichkevich
+ */
+public class AuthenticationClearInterceptor extends AbstractSoapInterceptor
+{
+ public AuthenticationClearInterceptor()
+ {
+ super(Phase.PRE_INVOKE);
+ }
+
+ public void handleMessage(SoapMessage message) throws Fault
+ {
+ AuthenticationUtil.clearCurrentSecurityContext();
+ }
+
+ @Override
+ public void handleFault(SoapMessage message)
+ {
+ AuthenticationUtil.clearCurrentSecurityContext();
+ super.handleFault(message);
+ }
+}
diff --git a/source/java/org/alfresco/repo/cmis/ws/AuthenticationInterceptor.java b/source/java/org/alfresco/repo/cmis/ws/AuthenticationInterceptor.java
index 90e5060574..48f3eb840b 100644
--- a/source/java/org/alfresco/repo/cmis/ws/AuthenticationInterceptor.java
+++ b/source/java/org/alfresco/repo/cmis/ws/AuthenticationInterceptor.java
@@ -26,7 +26,9 @@ package org.alfresco.repo.cmis.ws;
import java.util.List;
-import org.alfresco.repo.security.authentication.AuthenticationUtil;
+import org.alfresco.repo.transaction.RetryingTransactionHelper.RetryingTransactionCallback;
+import org.alfresco.service.cmr.security.AuthenticationService;
+import org.alfresco.service.transaction.TransactionService;
import org.apache.cxf.binding.soap.SoapMessage;
import org.apache.cxf.binding.soap.interceptor.AbstractSoapInterceptor;
import org.apache.cxf.interceptor.Fault;
@@ -36,8 +38,13 @@ import org.apache.ws.security.WSUsernameTokenPrincipal;
import org.apache.ws.security.handler.WSHandlerConstants;
import org.apache.ws.security.handler.WSHandlerResult;
+/**
+ * @author Dmitry Velichkevich
+ */
public class AuthenticationInterceptor extends AbstractSoapInterceptor
{
+ private AuthenticationService authenticationService;
+ private TransactionService transactionService;
public AuthenticationInterceptor()
{
@@ -49,10 +56,34 @@ public class AuthenticationInterceptor extends AbstractSoapInterceptor
@SuppressWarnings("unchecked")
WSHandlerResult handlerResult = ((List) message.getContextualProperty(WSHandlerConstants.RECV_RESULTS)).get(0);
WSSecurityEngineResult secRes = (WSSecurityEngineResult) handlerResult.getResults().get(0);
- WSUsernameTokenPrincipal principal = (WSUsernameTokenPrincipal) secRes.get(WSSecurityEngineResult.TAG_PRINCIPAL);
+ final WSUsernameTokenPrincipal principal = (WSUsernameTokenPrincipal) secRes.get(WSSecurityEngineResult.TAG_PRINCIPAL);
// Authenticate
- AuthenticationUtil.setFullyAuthenticatedUser(principal.getName());
+ transactionService.getRetryingTransactionHelper().doInTransaction(new RetryingTransactionCallback