mirror of
https://github.com/Alfresco/alfresco-community-repo.git
synced 2025-08-07 17:49:17 +00:00
Merged V3.0 to HEAD
11905: Merged V2.2 to V3.0 11782: Fix security in RunAs using public APIs (ETWOTWO-816). 11907: ETHREEOH-846 11908: More work on Shutdown Backstop 11909: Speculative fix for EHTREEOH-782. 11912: ETHREEOH-746 Unable to view contents of previous versions of wiki page 11915: ETHREEOH-746 Unable to view contents of previous versions of wiki page 11916: Upgrade from YUI 2.5.2 to YUI 2.6.0 - Second stage (Paginators, DocLib Tree, Resizer widget) 11917: ETHREEOH-874 and ETHREEOH-875 11918: ETHREEOH-860 git-svn-id: https://svn.alfresco.com/repos/alfresco-enterprise/alfresco/HEAD/root@12487 c4b6b30b-aa2e-2d43-bbcb-ca4b014f7261
This commit is contained in:
@@ -30,17 +30,18 @@ import net.sf.acegisecurity.GrantedAuthorityImpl;
|
||||
import net.sf.acegisecurity.UserDetails;
|
||||
import net.sf.acegisecurity.context.Context;
|
||||
import net.sf.acegisecurity.context.ContextHolder;
|
||||
import net.sf.acegisecurity.context.security.SecureContext;
|
||||
import net.sf.acegisecurity.context.security.SecureContextImpl;
|
||||
import net.sf.acegisecurity.providers.UsernamePasswordAuthenticationToken;
|
||||
import net.sf.acegisecurity.providers.dao.User;
|
||||
|
||||
import org.alfresco.repo.tenant.TenantService;
|
||||
import org.alfresco.service.cmr.security.PermissionService;
|
||||
import org.apache.commons.logging.Log;
|
||||
import org.apache.commons.logging.LogFactory;
|
||||
import org.apache.log4j.NDC;
|
||||
|
||||
public abstract class AuthenticationUtil
|
||||
{
|
||||
static Log s_logger = LogFactory.getLog(AuthenticationUtil.class);
|
||||
|
||||
public interface RunAsWork<Result>
|
||||
{
|
||||
@@ -249,7 +250,8 @@ public abstract class AuthenticationUtil
|
||||
}
|
||||
authentication.setAuthenticated(true);
|
||||
// Sets real and effective
|
||||
sc.setAuthentication(authentication);
|
||||
sc.setRealAuthentication(authentication);
|
||||
sc.setEffectiveAuthentication(authentication);
|
||||
|
||||
// Support for logging tenant domain / username (via log4j NDC)
|
||||
String userName = SYSTEM_USER_NAME;
|
||||
@@ -606,7 +608,13 @@ public abstract class AuthenticationUtil
|
||||
}
|
||||
else
|
||||
{
|
||||
if(!AuthenticationUtil.getCurrentRealUserName().equals(realUser))
|
||||
{
|
||||
AuthenticationUtil.setCurrentRealUser(realUser);
|
||||
s_logger.warn("Resetting real user which has changed in RunAs block");
|
||||
}
|
||||
AuthenticationUtil.setCurrentEffectiveUser(effectiveUser);
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user