Merged HEAD-BUG-FIX (4.3/Cloud) to HEAD (4.3/Cloud)

57792: Merged V4.2-BUG-FIX (4.2.1) to HEAD-BUG-FIX (Cloud/4.3)
      57768: Merged V4.1-BUG-FIX (4.1.8) to V4.2-BUG-FIX (4.2.1)
         57694: Merged DEV to V4.1-BUG-FIX (4.1.8)
            57603: MNT-9284 : Upload speed using CIFS between PostgreSQL and SQL Server 2008
            Deleted an unnecessary transaction in org.alfresco.filesys.auth.cifs.CifsAuthenticatorBase#setCurrentUser.


git-svn-id: https://svn.alfresco.com/repos/alfresco-enterprise/alfresco/HEAD/root@61879 c4b6b30b-aa2e-2d43-bbcb-ca4b014f7261
This commit is contained in:
Alan Davis
2014-02-11 22:05:12 +00:00
parent 84a951b647
commit b8ff47de1e

View File

@@ -1,5 +1,5 @@
/* /*
* Copyright (C) 2005-2010 Alfresco Software Limited. * Copyright (C) 2005-2013 Alfresco Software Limited.
* *
* This file is part of Alfresco * This file is part of Alfresco
* *
@@ -450,75 +450,67 @@ public abstract class CifsAuthenticatorBase extends CifsAuthenticator implements
getAuthenticationComponent().clearCurrentSecurityContext(); getAuthenticationComponent().clearCurrentSecurityContext();
return; return;
} }
if (client.isGuest() == false && client instanceof AlfrescoClientInfo)
doInTransaction(new RetryingTransactionHelper.RetryingTransactionCallback<Object>()
{ {
public Object execute() throws Throwable // Set the authentication context for the request
AlfrescoClientInfo alfClient = (AlfrescoClientInfo) client;
if (alfClient.hasAuthenticationTicket())
{ {
if (client.isGuest() == false && client instanceof AlfrescoClientInfo) boolean ticketFailed = false;
try
{ {
// Set the authentication context for the request getAuthenticationService().validate(alfClient.getAuthenticationTicket());
}
catch (AuthenticationException e)
{
// Indicate the existing ticket is bad
AlfrescoClientInfo alfClient = (AlfrescoClientInfo) client; ticketFailed = true;
if (alfClient.hasAuthenticationTicket())
{
boolean ticketFailed = false;
try // DEBUG
{
getAuthenticationService().validate(alfClient.getAuthenticationTicket());
}
catch (AuthenticationException e)
{
// Indicate the existing ticket is bad
ticketFailed = true; if ( logger.isDebugEnabled())
logger.debug("Failed to validate ticket, user=" + client.getUserName() + ", ticket=" + alfClient.getAuthenticationTicket());
}
// DEBUG // If the ticket did not validate then try and get a new ticket for the user
if ( logger.isDebugEnabled()) if ( ticketFailed == true) {
logger.debug("Failed to validate ticket, user=" + client.getUserName() + ", ticket=" + alfClient.getAuthenticationTicket());
}
// If the ticket did not validate then try and get a new ticket for the user try {
String normalized = mapUserNameToPerson( client.getUserName(), false);
if ( ticketFailed == true) { getAuthenticationComponent().setCurrentUser( normalized);
alfClient.setAuthenticationTicket(getAuthenticationService().getCurrentTicket());
try {
String normalized = mapUserNameToPerson( client.getUserName(), false);
getAuthenticationComponent().setCurrentUser( normalized);
alfClient.setAuthenticationTicket(getAuthenticationService().getCurrentTicket());
}
catch ( AuthenticationException ex) {
// Cannot get a new ticket for the user
if ( logger.isErrorEnabled()) {
logger.error("Failed to get new ticket for user=" + client.getUserName());
logger.error( ex);
}
// Clear the ticket/security context
alfClient.setAuthenticationTicket(null);
getAuthenticationComponent().clearCurrentSecurityContext();
}
}
} }
else catch ( AuthenticationException ex) {
{
// Cannot get a new ticket for the user
if ( logger.isErrorEnabled()) {
logger.error("Failed to get new ticket for user=" + client.getUserName());
logger.error( ex);
}
// Clear the ticket/security context
alfClient.setAuthenticationTicket(null);
getAuthenticationComponent().clearCurrentSecurityContext(); getAuthenticationComponent().clearCurrentSecurityContext();
} }
} }
else
{
// Enable guest access for the request
getAuthenticationComponent().setGuestUserAsCurrentUser();
}
return null;
} }
}); else
{
getAuthenticationComponent().clearCurrentSecurityContext();
}
}
else
{
// Enable guest access for the request
getAuthenticationComponent().setGuestUserAsCurrentUser();
}
} }
/** /**