当前位置: 首页>>代码示例>>Java>>正文


Java UserRegistrySynchronizer类代码示例

本文整理汇总了Java中org.alfresco.repo.security.sync.UserRegistrySynchronizer的典型用法代码示例。如果您正苦于以下问题:Java UserRegistrySynchronizer类的具体用法?Java UserRegistrySynchronizer怎么用?Java UserRegistrySynchronizer使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


UserRegistrySynchronizer类属于org.alfresco.repo.security.sync包,在下文中一共展示了UserRegistrySynchronizer类的11个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: prepareTestConditions

import org.alfresco.repo.security.sync.UserRegistrySynchronizer; //导入依赖的package包/类
private TestContext prepareTestConditions(boolean autoCreatePeopleOnLogin, String userName) throws Exception
{
    UserRegistrySynchronizer userRegistrySynchronizer = makeUserRegistrySynchronizerStub(autoCreatePeopleOnLogin);
    ((AbstractAuthenticationComponent) cifsAuthenticator.getAuthenticationComponent()).setUserRegistrySynchronizer(userRegistrySynchronizer);

    ClientInfo client = mock(AlfrescoClientInfo.class);
    client.setUserName(userName);
    SrvSession sess = mock(SMBSrvSession.class);
    sess.setUniqueId(userName);
    // add getter to the original class, otherwise reflection should be used to add session to private field
    AuthenticateSession as = mock(AuthenticateSession.class);
    // assume successful passthru authentication
    doNothing().when(as).doSessionSetup(anyString(), anyString(), anyString(), any(byte[].class), any(byte[].class), anyInt());
    PassthruDetails pd = new PassthruDetails(sess, as);
    cifsAuthenticator.getSessions().put(userName, pd);

    return new TestContext(client, sess);
}
 
开发者ID:Alfresco,项目名称:alfresco-repository,代码行数:19,代码来源:CifsAuthenticatorPassthruTest.java

示例2: makeUserRegistrySynchronizerStub

import org.alfresco.repo.security.sync.UserRegistrySynchronizer; //导入依赖的package包/类
private UserRegistrySynchronizer makeUserRegistrySynchronizerStub(final boolean autoCreatePeopleOnLogin)
{
    UserRegistrySynchronizer stub = mock(UserRegistrySynchronizer.class);
    when(stub.createMissingPerson(anyString())).thenAnswer(new Answer<Boolean>()
    {
        public Boolean answer(InvocationOnMock invocation) throws Throwable
        {
            Object[] args = invocation.getArguments();
            String userName = (String) args[0];
            
            if (userName != null && !userName.equals(AuthenticationUtil.getSystemUserName()))
            {
                PersonService personServiceStub = mock(PersonService.class);
                when(personServiceStub.createMissingPeople()).thenReturn(true);
                if (autoCreatePeopleOnLogin && personServiceStub.createMissingPeople())
                {
                    AuthorityType authorityType = AuthorityType.getAuthorityType(userName);
                    if (authorityType == AuthorityType.USER)
                    {
                        personService.getPerson(userName);
                        return true;
                    }
                }
            }
            return false;
        }
    });
    return stub;
}
 
开发者ID:Alfresco,项目名称:alfresco-repository,代码行数:30,代码来源:CifsAuthenticatorKerberosTest.java

示例3: testExistingUserMappingWhenAutoCreateNotAllowed

import org.alfresco.repo.security.sync.UserRegistrySynchronizer; //导入依赖的package包/类
@Test
public void testExistingUserMappingWhenAutoCreateNotAllowed()
{
    UserRegistrySynchronizer userRegistrySynchronizer = makeUserRegistrySynchronizerStub(false);
    ((AbstractAuthenticationComponent) cifsAuthenticator.getAuthenticationComponent()).setUserRegistrySynchronizer(userRegistrySynchronizer);
    String username = cifsAuthenticator.mapUserNameToPerson(userExistingLocal, false);
    assertEquals("Existing local user should be mapped to authenticated AD user", username, userExistingLocal);
}
 
开发者ID:Alfresco,项目名称:alfresco-repository,代码行数:9,代码来源:CifsAuthenticatorKerberosTest.java

示例4: testExistingUserMappingWhenAutoCreateAllowed

import org.alfresco.repo.security.sync.UserRegistrySynchronizer; //导入依赖的package包/类
@Test
public void testExistingUserMappingWhenAutoCreateAllowed()
{
    UserRegistrySynchronizer userRegistrySynchronizer = makeUserRegistrySynchronizerStub(true);
    ((AbstractAuthenticationComponent) cifsAuthenticator.getAuthenticationComponent()).setUserRegistrySynchronizer(userRegistrySynchronizer);
    String username = cifsAuthenticator.mapUserNameToPerson(userExistingLocal, false);
    assertEquals("Existing local user should be mapped to authenticated AD user", username, userExistingLocal);
}
 
开发者ID:Alfresco,项目名称:alfresco-repository,代码行数:9,代码来源:CifsAuthenticatorKerberosTest.java

示例5: testMissingUserMappingWhenAutoCreateNotAllowed

import org.alfresco.repo.security.sync.UserRegistrySynchronizer; //导入依赖的package包/类
@Test
public void testMissingUserMappingWhenAutoCreateNotAllowed()
{
    UserRegistrySynchronizer userRegistrySynchronizer = makeUserRegistrySynchronizerStub(false);
    ((AbstractAuthenticationComponent) cifsAuthenticator.getAuthenticationComponent()).setUserRegistrySynchronizer(userRegistrySynchronizer);
    try
    {
        cifsAuthenticator.mapUserNameToPerson(userMissingLocal, false);
        fail("User that does not exist in repository should not login when autoCreatePeopleOnLogin is not allowed");
    }
    catch (AuthenticationException expected)
    {
    }
}
 
开发者ID:Alfresco,项目名称:alfresco-repository,代码行数:15,代码来源:CifsAuthenticatorKerberosTest.java

示例6: testMissingUserMappingWhenAutoCreateAllowed

import org.alfresco.repo.security.sync.UserRegistrySynchronizer; //导入依赖的package包/类
@Test
public void testMissingUserMappingWhenAutoCreateAllowed()
{
    UserRegistrySynchronizer userRegistrySynchronizer = makeUserRegistrySynchronizerStub(true);
    ((AbstractAuthenticationComponent) cifsAuthenticator.getAuthenticationComponent()).setUserRegistrySynchronizer(userRegistrySynchronizer);
    String username = cifsAuthenticator.mapUserNameToPerson(userMissingLocal, false);
    assertEquals("User that does not exist in repository can login when autoCreatePeopleOnLogin is allowed", username, userMissingLocal);
    // personService.personExists requires RunAsUser to be set
    AuthenticationUtil.setRunAsUser(AuthenticationUtil.getSystemUserName());
    assertTrue(personService.personExists(userMissingLocal));
}
 
开发者ID:Alfresco,项目名称:alfresco-repository,代码行数:12,代码来源:CifsAuthenticatorKerberosTest.java

示例7: makeUserRegistrySynchronizerStub

import org.alfresco.repo.security.sync.UserRegistrySynchronizer; //导入依赖的package包/类
private UserRegistrySynchronizer makeUserRegistrySynchronizerStub(final boolean autoCreatePeopleOnLogin)
{
    UserRegistrySynchronizer stub = mock(UserRegistrySynchronizer.class);
    when(stub.createMissingPerson(anyString())).thenAnswer(new Answer<Boolean>()
    {
        public Boolean answer(InvocationOnMock invocation) throws Throwable
        {
            Object[] args = invocation.getArguments();
            String userName = (String) args[0];

            if (userName != null && !userName.equals(AuthenticationUtil.getSystemUserName()))
            {
                PersonService personServiceStub = mock(PersonService.class);
                when(personServiceStub.createMissingPeople()).thenReturn(true);
                if (autoCreatePeopleOnLogin && personServiceStub.createMissingPeople())
                {
                    AuthorityType authorityType = AuthorityType.getAuthorityType(userName);
                    if (authorityType == AuthorityType.USER)
                    {
                        personService.getPerson(userName);
                        return true;
                    }
                }
            }
            return false;
        }
    });
    return stub;
}
 
开发者ID:Alfresco,项目名称:alfresco-repository,代码行数:30,代码来源:CifsAuthenticatorPassthruTest.java

示例8: execute

import org.alfresco.repo.security.sync.UserRegistrySynchronizer; //导入依赖的package包/类
/**
 *
 * {@inheritDoc}
 */
@Override
public void execute(final JobExecutionContext executionContext) throws JobExecutionException
{
    final UserRegistrySynchronizer userRegistrySynchronizer = (UserRegistrySynchronizer) executionContext.getJobDetail().getJobDataMap()
            .get("userRegistrySynchronizer");
    final TenantAdminService tenantAdminService = (TenantAdminService) executionContext.getJobDetail().getJobDataMap()
            .get("tenantAdminService");
    final String synchronizeChangesOnly = (String) executionContext.getJobDetail().getJobDataMap().get("synchronizeChangesOnly");
    final boolean forceUpdate = synchronizeChangesOnly == null || !Boolean.parseBoolean(synchronizeChangesOnly);
    final String tenantDomain = (String) executionContext.getJobDetail().getJobDataMap().get("tenantDomain");

    if (TenantUtil.DEFAULT_TENANT.equals(tenantDomain))
    {
        LOGGER.debug("Triggering synchronization for default tenant");
        AuthenticationUtil.runAs(() -> {
            userRegistrySynchronizer.synchronize(forceUpdate, true);
            return null;
        }, AuthenticationUtil.getSystemUserName());
    }
    else if (tenantAdminService.isEnabled() && tenantAdminService.existsTenant(tenantDomain)
            && tenantAdminService.isEnabledTenant(tenantDomain))
    {
        LOGGER.debug("Triggering synchronization for {} tenant", tenantDomain);
        TenantUtil.runAsSystemTenant(() -> {
            userRegistrySynchronizer.synchronize(forceUpdate, true);
            return null;
        }, tenantDomain);
    }
    else
    {
        LOGGER.debug("Failed to trigger snychronization as either multi-tenancy is disabled, tenant {} does not exist or is disabled",
                tenantDomain);
    }
}
 
开发者ID:Acosix,项目名称:alfresco-mt-support,代码行数:39,代码来源:TenantAwareUserRegistrySynchronizerJob.java

示例9: setUserRegistrySynchronizer

import org.alfresco.repo.security.sync.UserRegistrySynchronizer; //导入依赖的package包/类
public void setUserRegistrySynchronizer(UserRegistrySynchronizer userRegistrySynchronizer)
{
    this.userRegistrySynchronizer = userRegistrySynchronizer;
}
 
开发者ID:Alfresco,项目名称:alfresco-repository,代码行数:5,代码来源:AbstractAuthenticationComponent.java

示例10: setUserRegistrySynchronizer

import org.alfresco.repo.security.sync.UserRegistrySynchronizer; //导入依赖的package包/类
/**
 * @param userRegistrySynchronizer UserRegistrySynchronizer
 */
public void setUserRegistrySynchronizer(UserRegistrySynchronizer userRegistrySynchronizer)
{
   this.userRegistrySynchronizer = userRegistrySynchronizer;
}
 
开发者ID:Alfresco,项目名称:community-edition-old,代码行数:8,代码来源:UsersBeanProperties.java

示例11: setUserRegistrySynchronizer

import org.alfresco.repo.security.sync.UserRegistrySynchronizer; //导入依赖的package包/类
/**
 * Set the UserRegistrySynchronizer
 * 
 * @param userRegistrySynchronizer UserRegistrySynchronizer
 */
public void setUserRegistrySynchronizer(UserRegistrySynchronizer userRegistrySynchronizer)
{
    this.userRegistrySynchronizer = userRegistrySynchronizer;
}
 
开发者ID:Alfresco,项目名称:alfresco-repository,代码行数:10,代码来源:People.java


注:本文中的org.alfresco.repo.security.sync.UserRegistrySynchronizer类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。