Merged BRANCHES/DEV/THOR1 to HEAD:

=> CLOUD-1347 / CLOUD-1348 
   30569: THOR-156
   30776: THOR-172


git-svn-id: https://svn.alfresco.com/repos/alfresco-enterprise/alfresco/HEAD/root@46551 c4b6b30b-aa2e-2d43-bbcb-ca4b014f7261
This commit is contained in:
Jan Vonka
2013-02-13 09:42:13 +00:00
parent 1be15184cb
commit 1616d63a25
9 changed files with 127 additions and 299 deletions

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
*
@@ -32,7 +32,9 @@ import net.sf.acegisecurity.providers.UsernamePasswordAuthenticationToken;
import org.alfresco.error.AlfrescoRuntimeException;
import org.alfresco.repo.security.authentication.AuthenticationUtil.RunAsWork;
import org.alfresco.repo.security.authentication.ntlm.NLTMAuthenticator;
import org.alfresco.repo.tenant.TenantContextHolder;
import org.alfresco.repo.transaction.RetryingTransactionHelper.RetryingTransactionCallback;
import org.alfresco.util.Pair;
public class AuthenticationComponentImpl extends AbstractAuthenticationComponent implements NLTMAuthenticator
{
@@ -69,10 +71,14 @@ public class AuthenticationComponentImpl extends AbstractAuthenticationComponent
* Authenticate
*/
@Override
protected void authenticateImpl(final String userName, final char[] password) throws AuthenticationException
protected void authenticateImpl(final String userNameIn, final char[] password) throws AuthenticationException
{
try
{
Pair<String, String> userTenant = AuthenticationUtil.getUserTenant(userNameIn);
final String userName = userTenant.getFirst();
final String tenantDomain = userTenant.getSecond();
String normalized = getTransactionService().getRetryingTransactionHelper().doInTransaction(
new RetryingTransactionCallback<String>()
{
@@ -90,7 +96,8 @@ public class AuthenticationComponentImpl extends AbstractAuthenticationComponent
}
}, getSystemUserName(getUserDomain(userName)));
}
}, true);
}, true);
if (normalized == null)
{
setCurrentUser(userName, UserNameValidationMode.CHECK_AND_FIX);
@@ -99,6 +106,8 @@ public class AuthenticationComponentImpl extends AbstractAuthenticationComponent
{
setCurrentUser(normalized, UserNameValidationMode.NONE);
}
TenantContextHolder.setTenantDomain(tenantDomain);
}
catch (net.sf.acegisecurity.AuthenticationException ae)
{