mirror of
https://github.com/Alfresco/alfresco-community-repo.git
synced 2025-08-07 17:49:17 +00:00
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:
@@ -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());
|
||||||
|
}
|
||||||
AlfrescoClientInfo alfClient = (AlfrescoClientInfo) client;
|
catch (AuthenticationException e)
|
||||||
if (alfClient.hasAuthenticationTicket())
|
{
|
||||||
{
|
// Indicate the existing ticket is bad
|
||||||
boolean ticketFailed = false;
|
|
||||||
|
|
||||||
try
|
|
||||||
{
|
|
||||||
getAuthenticationService().validate(alfClient.getAuthenticationTicket());
|
|
||||||
}
|
|
||||||
catch (AuthenticationException e)
|
|
||||||
{
|
|
||||||
// Indicate the existing ticket is bad
|
|
||||||
|
|
||||||
ticketFailed = true;
|
|
||||||
|
|
||||||
// DEBUG
|
|
||||||
|
|
||||||
if ( logger.isDebugEnabled())
|
|
||||||
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
|
|
||||||
|
|
||||||
if ( ticketFailed == true) {
|
|
||||||
|
|
||||||
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()) {
|
ticketFailed = true;
|
||||||
logger.error("Failed to get new ticket for user=" + client.getUserName());
|
|
||||||
logger.error( ex);
|
|
||||||
}
|
|
||||||
|
|
||||||
// Clear the ticket/security context
|
// DEBUG
|
||||||
|
|
||||||
alfClient.setAuthenticationTicket(null);
|
if ( logger.isDebugEnabled())
|
||||||
getAuthenticationComponent().clearCurrentSecurityContext();
|
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
|
||||||
|
|
||||||
|
if ( ticketFailed == true) {
|
||||||
|
|
||||||
|
try {
|
||||||
|
String normalized = mapUserNameToPerson( client.getUserName(), false);
|
||||||
|
getAuthenticationComponent().setCurrentUser( normalized);
|
||||||
|
alfClient.setAuthenticationTicket(getAuthenticationService().getCurrentTicket());
|
||||||
}
|
}
|
||||||
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();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
Reference in New Issue
Block a user