mirror of
https://github.com/Alfresco/alfresco-community-repo.git
synced 2025-07-31 17:39:05 +00:00
Added authentication to AVM Crawler
git-svn-id: https://svn.alfresco.com/repos/alfresco-enterprise/alfresco/HEAD/root@11225 c4b6b30b-aa2e-2d43-bbcb-ca4b014f7261
This commit is contained in:
@@ -34,6 +34,9 @@ import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.Random;
|
||||
|
||||
import net.sf.acegisecurity.Authentication;
|
||||
|
||||
import org.alfresco.repo.security.authentication.AuthenticationUtil;
|
||||
import org.alfresco.service.cmr.avm.AVMException;
|
||||
import org.alfresco.service.cmr.avm.AVMNodeDescriptor;
|
||||
import org.alfresco.service.cmr.avm.AVMService;
|
||||
@@ -51,6 +54,8 @@ class AVMCrawler implements Runnable
|
||||
* The AVMService to use.
|
||||
*/
|
||||
private AVMService fService;
|
||||
|
||||
private Authentication authentication;
|
||||
|
||||
/**
|
||||
* The Operation count.
|
||||
@@ -77,9 +82,10 @@ class AVMCrawler implements Runnable
|
||||
* Make up a new one.
|
||||
* @param service The AVMService.
|
||||
*/
|
||||
public AVMCrawler(AVMService service)
|
||||
public AVMCrawler(AVMService service, Authentication authentication)
|
||||
{
|
||||
fService = service;
|
||||
this.authentication = authentication;
|
||||
fOpCount = 0;
|
||||
fDone = false;
|
||||
fError = false;
|
||||
@@ -117,6 +123,7 @@ class AVMCrawler implements Runnable
|
||||
{
|
||||
try
|
||||
{
|
||||
AuthenticationUtil.setCurrentAuthentication(authentication);
|
||||
while (!fDone)
|
||||
{
|
||||
doCrawl();
|
||||
@@ -133,6 +140,10 @@ class AVMCrawler implements Runnable
|
||||
fError = true;
|
||||
fErrorStackTrace = sw.toString();
|
||||
}
|
||||
finally
|
||||
{
|
||||
AuthenticationUtil.clearCurrentSecurityContext();
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
|
Reference in New Issue
Block a user