From ac461f16bdee24efc1f68ea384e62d0df3ed3fcc Mon Sep 17 00:00:00 2001 From: Alan Davis Date: Tue, 26 Nov 2013 18:05:54 +0000 Subject: [PATCH] Merged V4.1-BUG-FIX (4.1.8) to V4.2-BUG-FIX (4.2.1) 58290: Merged V4.1.7 (4.1.7) to V4.1-BUG-FIX (4.1.8) 58183: Merged DEV to V4.1.7 (4.1.7) 58123: MNT-9992 : Using CMIS authentication using "ROLE_TICKET" or user "null" of "" does not work any more. Added authentication using ticket in AuthenticationFilter. git-svn-id: https://svn.alfresco.com/repos/alfresco-enterprise/alfresco/BRANCHES/DEV/V4.2-BUG-FIX/root@58315 c4b6b30b-aa2e-2d43-bbcb-ca4b014f7261 --- .../webdav/auth/AuthenticationFilter.java | 21 +++++++++++++++---- 1 file changed, 17 insertions(+), 4 deletions(-) diff --git a/source/java/org/alfresco/repo/webdav/auth/AuthenticationFilter.java b/source/java/org/alfresco/repo/webdav/auth/AuthenticationFilter.java index 7a6b3ad50e..7f4fcf9105 100644 --- a/source/java/org/alfresco/repo/webdav/auth/AuthenticationFilter.java +++ b/source/java/org/alfresco/repo/webdav/auth/AuthenticationFilter.java @@ -40,6 +40,8 @@ import javax.servlet.http.HttpServletResponse; import org.alfresco.repo.SessionUser; import org.alfresco.repo.security.authentication.AuthenticationException; +import org.alfresco.repo.security.authentication.AuthenticationUtil; +import org.alfresco.repo.security.authentication.Authorization; import org.alfresco.repo.web.auth.BasicAuthCredentials; import org.alfresco.repo.web.auth.TicketCredentials; import org.alfresco.repo.web.filter.beans.DependencyInjectedFilter; @@ -161,10 +163,21 @@ public class AuthenticationFilter extends BaseAuthenticationFilter implements De password = ""; } - // Authenticate the user - - authenticationService.authenticate(username, password.toCharArray()); - authenticationListener.userAuthenticated(new BasicAuthCredentials(username, password)); + // First check if we already are authenticated + if (AuthenticationUtil.getFullyAuthenticatedUser() == null) + { + // We have to go to the repo and authenticate + Authorization auth = new Authorization(username, password); + if (auth.isTicket()) + { + authenticationService.validate(auth.getTicket()); + } + else + { + authenticationService.authenticate(username, password.toCharArray()); + authenticationListener.userAuthenticated(new BasicAuthCredentials(username, password)); + } + user = createUserEnvironment(httpReq.getSession(), authenticationService.getCurrentUserName(), authenticationService.getCurrentTicket(), false); // Success so break out