本文整理汇总了Java中org.alfresco.repo.security.authentication.AuthenticationContext类的典型用法代码示例。如果您正苦于以下问题:Java AuthenticationContext类的具体用法?Java AuthenticationContext怎么用?Java AuthenticationContext使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
AuthenticationContext类属于org.alfresco.repo.security.authentication包,在下文中一共展示了AuthenticationContext类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: setUp
import org.alfresco.repo.security.authentication.AuthenticationContext; //导入依赖的package包/类
public void setUp() throws Exception
{
transactionService = (TransactionService) ctx.getBean("transactionComponent");
namespaceService = (NamespaceService) ctx.getBean("namespaceService");
nodeService = (NodeService) ctx.getBean("nodeService");
searchService = (SearchService) ctx.getBean("searchService");
authenticationContext = (AuthenticationContext) ctx.getBean("authenticationContext");
tenantAdminService = (TenantAdminService) ctx.getBean("tenantAdminService");
patchService = (PatchService) ctx.getBean("PatchService");
// get the patches to play with
patchService.registerPatch((Patch)ctx.getBean("patch.sample.02"));
patchService.registerPatch((Patch)ctx.getBean("patch.sample.01"));
patchService.registerPatch((Patch)ctx.getBean("patch.sample.03"));
}
示例2: setUp
import org.alfresco.repo.security.authentication.AuthenticationContext; //导入依赖的package包/类
@Override
protected void setUp() throws Exception
{
this.synchronizer = (UserRegistrySynchronizer) ChainingUserRegistrySynchronizerTest.context
.getBean("testUserRegistrySynchronizer");
this.applicationContextManager = (MockApplicationContextManager) ChainingUserRegistrySynchronizerTest.context
.getBean("testApplicationContextManager");
this.personService = (PersonService) ChainingUserRegistrySynchronizerTest.context.getBean("personService");
this.authorityService = (AuthorityService) ChainingUserRegistrySynchronizerTest.context
.getBean("authorityService");
this.nodeService = (NodeService) ChainingUserRegistrySynchronizerTest.context.getBean("nodeService");
this.authenticationContext = (AuthenticationContext) ChainingUserRegistrySynchronizerTest.context
.getBean("authenticationContext");
// this.authenticationContext.setSystemUserAsCurrentUser();
//AuthenticationUtil.setFullyAuthenticatedUser(AuthenticationUtil.getAdminUserName());
this.authenticationContext.setSystemUserAsCurrentUser();
this.retryingTransactionHelper = (RetryingTransactionHelper) ChainingUserRegistrySynchronizerTest.context
.getBean("retryingTransactionHelper");
setHomeFolderCreationEager(false); // the normal default if using LDAP
this.namespaceService = (NamespaceService) ChainingUserRegistrySynchronizerTest.context
.getBean("namespaceService");
}
示例3: setUp
import org.alfresco.repo.security.authentication.AuthenticationContext; //导入依赖的package包/类
@SuppressWarnings("unchecked")
@Before
public void setUp() throws Exception
{
ChildApplicationContextFactory activitiesFeed = (ChildApplicationContextFactory) ctx.getBean("ActivitiesFeed");
ApplicationContext activitiesFeedCtx = activitiesFeed.getApplicationContext();
feedNotifier = (FeedNotifierImpl) activitiesFeedCtx.getBean("feedNotifier");
activityService = (ActivityService) activitiesFeedCtx.getBean("activityService");
feedGenerator = (FeedGenerator) activitiesFeedCtx.getBean("feedGenerator");
postLookup = (PostLookup) activitiesFeedCtx.getBean("postLookup");
ObjectFactory<ActivitiesFeedModelBuilder> feedModelBuilderFactory = (ObjectFactory<ActivitiesFeedModelBuilder>) activitiesFeedCtx.getBean("feedModelBuilderFactory");
EmailUserNotifier emailUserNotifier = (EmailUserNotifier) activitiesFeedCtx.getBean("emailUserNotifier");
tenantAdminService = (TenantAdminService) ctx.getBean("tenantAdminService");
transactionService = (TransactionService) ctx.getBean("transactionService");
personService = (PersonService) ctx.getBean("personService");
postDAO = (ActivityPostDAO) ctx.getBean("postDAO");
nodeService = (NodeService) ctx.getBean("nodeService");
namespaceService = (NamespaceService) ctx.getBean("namespaceService");
siteService = (SiteService) ctx.getBean("siteService");
repoAdminService = (RepoAdminService) ctx.getBean("repoAdminService");
actionService = (ActionService) ctx.getBean("ActionService");
authenticationContext = (AuthenticationContext) ctx.getBean("authenticationContext");
EmailHelper emailHelper = (EmailHelper) ctx.getBean("emailHelper");
AuthenticationUtil.setAdminUserAsFullyAuthenticatedUser();
// create some users
transactionService.getRetryingTransactionHelper().doInTransaction(new RetryingTransactionHelper.RetryingTransactionCallback<Void>()
{
@SuppressWarnings("synthetic-access")
public Void execute() throws Throwable
{
personNodeRef = createUser(userName1);
failingPersonNodeRef = createUser(userName2);
return null;
}
}, false, true);
// use our own user notifier for testing purposes
userNotifier = new RegisterErrorUserFeedNotifier();
userNotifier.setNodeService(nodeService);
userNotifier.setNamespaceService(namespaceService);
userNotifier.setSiteService(siteService);
userNotifier.setActivityService(activityService);
userNotifier.setRepoAdminService(repoAdminService);
userNotifier.setActionService(actionService);
userNotifier.setActivitiesFeedModelBuilderFactory(feedModelBuilderFactory);
userNotifier.setAuthenticationContext(authenticationContext);
userNotifier.setExcludedEmailSuffixes(emailUserNotifier.getExcludedEmailSuffixes());
userNotifier.setEmailHelper(emailHelper);
feedNotifier.setUserNotifier(userNotifier);
jobDetail = new JobDetail("feedNotifier", FeedNotifierJob.class);
JobDataMap jobDataMap = jobDetail.getJobDataMap();
jobDataMap.put("tenantAdminService", tenantAdminService);
jobDataMap.put("feedNotifier", feedNotifier);
feedNotifierJob = new FeedNotifierJob();
when(jobCtx.getJobDetail()).thenReturn(jobDetail);
}
示例4: before
import org.alfresco.repo.security.authentication.AuthenticationContext; //导入依赖的package包/类
@Before
public void before()
{
this.actionService = (ActionService)ctx.getBean("actionService");
this.ruleService = (RuleService)ctx.getBean("ruleService");
this.fileFolderService = (FileFolderService)ctx.getBean("FileFolderService");
this.transactionService = (TransactionService)ctx.getBean("transactionService");
this.nodeService = (NodeService)ctx.getBean("NodeService");
this.contentService = (ContentService)ctx.getBean("ContentService");
this.versionService = (VersionService) ctx.getBean("versionService");
this.lockService = (LockService) ctx.getBean("lockService");
this.taggingService = (TaggingService) ctx.getBean("TaggingService");
this.namespaceService = (NamespaceService) ctx.getBean("namespaceService");
this.repositoryHelper = (Repository)ctx.getBean("repositoryHelper");
this.factory = (AlfrescoCmisServiceFactory)ctx.getBean("CMISServiceFactory");
this.versionService = (VersionService) ctx.getBean("versionService");
this.cmisConnector = (CMISConnector) ctx.getBean("CMISConnector");
this.nodeDAO = (NodeDAO) ctx.getBean("nodeDAO");
this.authorityService = (AuthorityService)ctx.getBean("AuthorityService");
this.auditSubsystem = (AuditModelRegistryImpl) ctx.getBean("Audit");
this.permissionService = (PermissionService) ctx.getBean("permissionService");
this.dictionaryDAO = (DictionaryDAO)ctx.getBean("dictionaryDAO");
this.cmisDictionaryService = (CMISDictionaryService)ctx.getBean("OpenCMISDictionaryService1.1");
this.auditDAO = (AuditDAO) ctx.getBean("auditDAO");
this.nodeArchiveService = (NodeArchiveService) ctx.getBean("nodeArchiveService");
this.dictionaryService = (DictionaryService) ctx.getBean("dictionaryService");
this.workflowService = (WorkflowService) ctx.getBean("WorkflowService");
this.workflowAdminService = (WorkflowAdminService) ctx.getBean("workflowAdminService");
this.authenticationContext = (AuthenticationContext) ctx.getBean("authenticationContext");
this.tenantAdminService = (TenantAdminService) ctx.getBean("tenantAdminService");
this.tenantService = (TenantService) ctx.getBean("tenantService");
this.searchService = (SearchService) ctx.getBean("SearchService");
this.auditComponent = (AuditComponentImpl) ctx.getBean("auditComponent");
this.globalProperties = (java.util.Properties) ctx.getBean("global-properties");
this.globalProperties.setProperty(VersionableAspectTest.AUTO_VERSION_PROPS_KEY, "true");
}
示例5: setAuthenticationContext
import org.alfresco.repo.security.authentication.AuthenticationContext; //导入依赖的package包/类
/**
* Set authentication component
*/
public void setAuthenticationContext(
AuthenticationContext authenticationContext)
{
this.authenticationContext = authenticationContext;
}
示例6: setAuthenticationContext
import org.alfresco.repo.security.authentication.AuthenticationContext; //导入依赖的package包/类
public void setAuthenticationContext(AuthenticationContext authenticationContext)
{
this.authenticationContext = authenticationContext;
}
示例7: setAuthenticationContext
import org.alfresco.repo.security.authentication.AuthenticationContext; //导入依赖的package包/类
public void setAuthenticationContext(AuthenticationContext authenticationContext)
{
this.authenticationContext = authenticationContext;
}
示例8: setAuthenticationContext
import org.alfresco.repo.security.authentication.AuthenticationContext; //导入依赖的package包/类
/**
* @deprecated Not used since 3.4
*/
public void setAuthenticationContext(AuthenticationContext authenticationContext)
{
logger.warn("Property 'authenticationContext' is no longer required.");
}
示例9: before
import org.alfresco.repo.security.authentication.AuthenticationContext; //导入依赖的package包/类
@Before
public void before() throws Exception
{
ApplicationContextHelper.setUseLazyLoading(false);
//ApplicationContextHelper.setNoAutoStart(true);
ctx = ApplicationContextHelper.getApplicationContext();
this.personService = (PersonService) ctx.getBean("personService");
this.transactionService = (TransactionService) ctx.getBean("transactionService");
this.nodeService = (NodeService) ctx.getBean("nodeService");
this.authenticationContext = (AuthenticationContext) ctx.getBean("authenticationContext");
// cannot get bean from context directly because of side affects from passthruServers.afterPropertiesSet
this.cifsAuthenticator = new PassthruCifsAuthenticator();
this.cifsAuthenticator.setTransactionService(transactionService);
// passthru-authentication-context.xml : NTLMAuthenticationComponentImpl is used for passthru
AbstractAuthenticationComponent ac = new org.alfresco.repo.security.authentication.ntlm.NTLMAuthenticationComponentImpl();
ac.setPersonService(personService);
ac.setTransactionService(transactionService);
ac.setNodeService(nodeService);
ac.setAuthenticationContext(authenticationContext);
this.cifsAuthenticator.setAuthenticationComponent(ac);
this.cifsAuthenticator.setAuthenticationService(mock(org.alfresco.repo.security.authentication.AuthenticationServiceImpl.class));
// create only user1 in local repository
transactionService.getRetryingTransactionHelper().doInTransaction(new RetryingTransactionHelper.RetryingTransactionCallback<Void>()
{
@SuppressWarnings("synthetic-access")
public Void execute() throws Throwable
{
AuthenticationUtil.pushAuthentication();
AuthenticationUtil.setFullyAuthenticatedUser(AuthenticationUtil.getAdminUserName());
// create person properties
PropertyMap personProps = new PropertyMap();
personProps.put(ContentModel.PROP_USERNAME, userExistingLocal);
personProps.put(ContentModel.PROP_FIRSTNAME, userExistingLocal);
personProps.put(ContentModel.PROP_LASTNAME, userExistingLocal);
personProps.put(ContentModel.PROP_EMAIL, userExistingLocal + "@email.com");
personService.createPerson(personProps);
AuthenticationUtil.popAuthentication();
return null;
}
}, false, true);
}
示例10: initializeRootNode
import org.alfresco.repo.security.authentication.AuthenticationContext; //导入依赖的package包/类
/**
* @param storeValue String
* @param rootPath String
* @param context WebApplicationContext
* @param nodeService NodeService
* @param searchService SearchService
* @param namespaceService NamespaceService
* @param tenantService TenantService
* @param m_transactionService TransactionService
*/
private void initializeRootNode(String storeValue, String rootPath, WebApplicationContext context, NodeService nodeService, SearchService searchService,
NamespaceService namespaceService, TenantService tenantService, TransactionService m_transactionService)
{
// Use the system user as the authenticated context for the filesystem initialization
AuthenticationContext authComponent = (AuthenticationContext) context.getBean("authenticationContext");
authComponent.setSystemUserAsCurrentUser();
// Wrap the initialization in a transaction
UserTransaction tx = m_transactionService.getUserTransaction(true);
try
{
// Start the transaction
if (tx != null)
tx.begin();
StoreRef storeRef = new StoreRef(storeValue);
if (nodeService.exists(storeRef) == false)
{
throw new RuntimeException("No store for path: " + storeRef);
}
NodeRef storeRootNodeRef = nodeService.getRootNode(storeRef);
List<NodeRef> nodeRefs = searchService.selectNodes(storeRootNodeRef, rootPath, null, namespaceService, false);
if (nodeRefs.size() > 1)
{
throw new RuntimeException("Multiple possible children for : \n" + " path: " + rootPath + "\n" + " results: " + nodeRefs);
}
else if (nodeRefs.size() == 0)
{
throw new RuntimeException("Node is not found for : \n" + " root path: " + rootPath);
}
defaultRootNode = nodeRefs.get(0);
// Commit the transaction
if (tx != null)
tx.commit();
}
catch (Exception ex)
{
logger.error(ex);
}
finally
{
// Clear the current system user
authComponent.clearCurrentSecurityContext();
}
}
示例11: before
import org.alfresco.repo.security.authentication.AuthenticationContext; //导入依赖的package包/类
@Before
public void before() throws Exception
{
this.personService = (PersonService) ctx.getBean("personService");
this.transactionService = (TransactionService) ctx.getBean("transactionService");
this.nodeService = (NodeService) ctx.getBean("nodeService");
this.authenticationContext = (AuthenticationContext) ctx.getBean("authenticationContext");
// cannot get bean from context directly because of side affects from passthruServers.afterPropertiesSet
this.cifsAuthenticator = new PassthruCifsAuthenticator();
this.cifsAuthenticator.setTransactionService(transactionService);
// passthru-authentication-context.xml : NTLMAuthenticationComponentImpl is used for passthru
AbstractAuthenticationComponent ac = new org.alfresco.repo.security.authentication.ntlm.NTLMAuthenticationComponentImpl();
ac.setPersonService(personService);
ac.setTransactionService(transactionService);
ac.setNodeService(nodeService);
ac.setAuthenticationContext(authenticationContext);
this.cifsAuthenticator.setAuthenticationComponent(ac);
this.cifsAuthenticator.setAuthenticationService(mock(org.alfresco.repo.security.authentication.AuthenticationServiceImpl.class));
// create only user1 in local repository
transactionService.getRetryingTransactionHelper().doInTransaction(new RetryingTransactionHelper.RetryingTransactionCallback<Void>()
{
@SuppressWarnings("synthetic-access")
public Void execute() throws Throwable
{
AuthenticationUtil.pushAuthentication();
AuthenticationUtil.setFullyAuthenticatedUser(AuthenticationUtil.getAdminUserName());
// create person properties
PropertyMap personProps = new PropertyMap();
personProps.put(ContentModel.PROP_USERNAME, userExistingLocal);
personProps.put(ContentModel.PROP_FIRSTNAME, userExistingLocal);
personProps.put(ContentModel.PROP_LASTNAME, userExistingLocal);
personProps.put(ContentModel.PROP_EMAIL, userExistingLocal + "@email.com");
personService.createPerson(personProps);
AuthenticationUtil.popAuthentication();
return null;
}
}, false, true);
}
示例12: setUp
import org.alfresco.repo.security.authentication.AuthenticationContext; //导入依赖的package包/类
@SuppressWarnings("unchecked")
@Before
public void setUp() throws Exception
{
ChildApplicationContextFactory activitiesFeed = (ChildApplicationContextFactory) ctx.getBean("ActivitiesFeed");
ApplicationContext activitiesFeedCtx = activitiesFeed.getApplicationContext();
feedNotifier = (FeedNotifierImpl) activitiesFeedCtx.getBean("feedNotifier");
activityService = (ActivityService) activitiesFeedCtx.getBean("activityService");
feedGenerator = (FeedGenerator) activitiesFeedCtx.getBean("feedGenerator");
postLookup = (PostLookup) activitiesFeedCtx.getBean("postLookup");
ObjectFactory<ActivitiesFeedModelBuilder> feedModelBuilderFactory = (ObjectFactory<ActivitiesFeedModelBuilder>) activitiesFeedCtx.getBean("feedModelBuilderFactory");
EmailUserNotifier emailUserNotifier = (EmailUserNotifier) activitiesFeedCtx.getBean("emailUserNotifier");
tenantAdminService = (TenantAdminService) ctx.getBean("tenantAdminService");
transactionService = (TransactionService) ctx.getBean("transactionService");
personService = (PersonService) ctx.getBean("personService");
postDAO = (ActivityPostDAO) ctx.getBean("postDAO");
nodeService = (NodeService) ctx.getBean("nodeService");
namespaceService = (NamespaceService) ctx.getBean("namespaceService");
siteService = (SiteService) ctx.getBean("siteService");
repoAdminService = (RepoAdminService) ctx.getBean("repoAdminService");
actionService = (ActionService) ctx.getBean("ActionService");
authenticationContext = (AuthenticationContext) ctx.getBean("authenticationContext");
AuthenticationUtil.setAdminUserAsFullyAuthenticatedUser();
// create some users
transactionService.getRetryingTransactionHelper().doInTransaction(new RetryingTransactionHelper.RetryingTransactionCallback<Void>()
{
@SuppressWarnings("synthetic-access")
public Void execute() throws Throwable
{
personNodeRef = createUser(userName1);
failingPersonNodeRef = createUser(userName2);
return null;
}
}, false, true);
// use our own user notifier for testing purposes
userNotifier = new RegisterErrorUserFeedNotifier();
userNotifier.setNodeService(nodeService);
userNotifier.setNamespaceService(namespaceService);
userNotifier.setSiteService(siteService);
userNotifier.setActivityService(activityService);
userNotifier.setRepoAdminService(repoAdminService);
userNotifier.setActionService(actionService);
userNotifier.setActivitiesFeedModelBuilderFactory(feedModelBuilderFactory);
userNotifier.setAuthenticationContext(authenticationContext);
userNotifier.setExcludedEmailSuffixes(emailUserNotifier.getExcludedEmailSuffixes());
feedNotifier.setUserNotifier(userNotifier);
jobDetail = new JobDetail("feedNotifier", FeedNotifierJob.class);
JobDataMap jobDataMap = jobDetail.getJobDataMap();
jobDataMap.put("tenantAdminService", tenantAdminService);
jobDataMap.put("feedNotifier", feedNotifier);
feedNotifierJob = new FeedNotifierJob();
when(jobCtx.getJobDetail()).thenReturn(jobDetail);
}
示例13: getAuthenticationContext
import org.alfresco.repo.security.authentication.AuthenticationContext; //导入依赖的package包/类
/**
* Return the authentication context
*
* @return AuthenticationContext
*/
public final AuthenticationContext getAuthenticationContext() {
return authContext;
}
示例14: setAuthenticationContext
import org.alfresco.repo.security.authentication.AuthenticationContext; //导入依赖的package包/类
/**
* Set the authentication context
*
* @param authContext AuthenticationContext
*/
public void setAuthenticationContext(AuthenticationContext authContext)
{
this.authContext = authContext;
}
示例15: setAuthenticationContext
import org.alfresco.repo.security.authentication.AuthenticationContext; //导入依赖的package包/类
/**
* Set the authentication component
*
* @param authenticationContext AuthenticationContext
*/
public void setAuthenticationContext(AuthenticationContext authenticationContext)
{
this.authenticationContext = authenticationContext;
}