本文整理汇总了Java中org.jasig.services.persondir.support.StubPersonAttributeDao类的典型用法代码示例。如果您正苦于以下问题:Java StubPersonAttributeDao类的具体用法?Java StubPersonAttributeDao怎么用?Java StubPersonAttributeDao使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
StubPersonAttributeDao类属于org.jasig.services.persondir.support包,在下文中一共展示了StubPersonAttributeDao类的9个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。
示例1: checkServiceAttributeFilterAllAttributesWithCachingTurnedOn
import org.jasig.services.persondir.support.StubPersonAttributeDao; //导入依赖的package包/类
@Test
public void checkServiceAttributeFilterAllAttributesWithCachingTurnedOn() {
final ReturnAllAttributeReleasePolicy policy = new ReturnAllAttributeReleasePolicy();
final Map<String, List<Object>> attributes = new HashMap<>();
attributes.put("values", Arrays.asList(new Object[]{"v1", "v2", "v3"}));
attributes.put("cn", Arrays.asList(new Object[]{"commonName"}));
attributes.put("username", Arrays.asList(new Object[]{"uid"}));
final IPersonAttributeDao dao = new StubPersonAttributeDao(attributes);
final IPersonAttributes person = mock(IPersonAttributes.class);
when(person.getName()).thenReturn("uid");
when(person.getAttributes()).thenReturn(attributes);
final CachingPrincipalAttributesRepository repository =
new CachingPrincipalAttributesRepository(TimeUnit.MILLISECONDS, 100);
repository.setAttributeRepository(dao);
final Principal p = new DefaultPrincipalFactory().createPrincipal("uid",
Collections.<String, Object>singletonMap("mail", "[email protected]"));
policy.setPrincipalAttributesRepository(repository);
final Map<String, Object> attr = policy.getAttributes(p);
assertEquals(attr.size(), attributes.size());
}
开发者ID:hsj-xiaokang,项目名称:springboot-shiro-cas-mybatis,代码行数:27,代码来源:RegisteredServiceAttributeReleasePolicyTests.java
示例2: setUp
import org.jasig.services.persondir.support.StubPersonAttributeDao; //导入依赖的package包/类
@Before
public void setUp() throws Exception {
final Map<String, List<Object>> attributes = new HashMap<>();
attributes.put("test", Arrays.asList(new Object[] {"test"}));
this.repository = new StubPersonAttributeDao();
this.repository.setBackingMap(attributes);
this.registeredServiceFactory = new DefaultRegisteredServiceFactory();
this.registeredServiceFactory.setFormDataPopulators(ImmutableList.of(new AttributeFormDataPopulator(this
.repository)));
this.registeredServiceFactory.initializeDefaults();
this.manager = new DefaultServicesManagerImpl(
new InMemoryServiceRegistryDaoImpl());
this.manager.setApplicationEventPublisher(mock(ApplicationEventPublisher.class));
this.controller = new RegisteredServiceSimpleFormController(this.manager, this.registeredServiceFactory);
}
开发者ID:hsj-xiaokang,项目名称:springboot-shiro-cas-mybatis,代码行数:19,代码来源:RegisteredServiceSimpleFormControllerTests.java
示例3: checkServiceAttributeFilterAllAttributesWithCachingTurnedOn
import org.jasig.services.persondir.support.StubPersonAttributeDao; //导入依赖的package包/类
@Test
public void checkServiceAttributeFilterAllAttributesWithCachingTurnedOn() {
final ReturnAllAttributeReleasePolicy policy = new ReturnAllAttributeReleasePolicy();
final Map<String, List<Object>> attributes = new HashMap<>();
attributes.put("values", Arrays.asList(new Object[]{"v1", "v2", "v3"}));
attributes.put("cn", Arrays.asList(new Object[]{"commonName"}));
attributes.put("username", Arrays.asList(new Object[]{"uid"}));
final IPersonAttributeDao dao = new StubPersonAttributeDao(attributes);
final IPersonAttributes person = mock(IPersonAttributes.class);
when(person.getName()).thenReturn("uid");
when(person.getAttributes()).thenReturn(attributes);
final PrincipalAttributesRepository repository =
new CachingPrincipalAttributesRepository(dao, TimeUnit.MILLISECONDS, 100);
final Principal p = new DefaultPrincipalFactory().createPrincipal("uid",
Collections.<String, Object>singletonMap("mail", "[email protected]"));
policy.setPrincipalAttributesRepository(repository);
final Map<String, Object> attr = policy.getAttributes(p);
assertEquals(attr.size(), attributes.size());
}
开发者ID:hsj-xiaokang,项目名称:springboot-shiro-cas-mybatis,代码行数:26,代码来源:AttributeReleasePolicyTests.java
示例4: setUp
import org.jasig.services.persondir.support.StubPersonAttributeDao; //导入依赖的package包/类
@Before
public void setUp() throws Exception {
final Map<String, List<Object>> attributes = new HashMap<String, List<Object>>();
attributes.put("test", Arrays.asList(new Object[] {"test"}));
this.repository = new StubPersonAttributeDao();
this.repository.setBackingMap(attributes);
this.manager = new DefaultServicesManagerImpl(
new InMemoryServiceRegistryDaoImpl());
final RegisteredServiceValidator validator = new RegisteredServiceValidator();
validator.setServicesManager(this.manager);
this.controller = new RegisteredServiceSimpleFormController(
this.manager, this.repository);
this.controller.setCommandName("registeredService");
this.controller.setValidator(validator);
}
开发者ID:luotuo,项目名称:cas4.0.x-server-wechat,代码行数:20,代码来源:RegisteredServiceSimpleFormControllerTests.java
示例5: getAttributeRepository
import org.jasig.services.persondir.support.StubPersonAttributeDao; //导入依赖的package包/类
public static IPersonAttributeDao getAttributeRepository() {
final Map<String, List<Object>> attributes = new HashMap<>();
attributes.put("uid", (List) ImmutableList.of(CONST_USERNAME));
attributes.put("cn", (List) ImmutableList.of(CONST_USERNAME.toUpperCase()));
attributes.put("givenName", (List) ImmutableList.of(CONST_USERNAME));
attributes.put("memberOf", (List) ImmutableList.of("system", "admin", "cas"));
return new StubPersonAttributeDao(attributes);
}
开发者ID:hsj-xiaokang,项目名称:springboot-shiro-cas-mybatis,代码行数:9,代码来源:TestUtils.java
示例6: getRegisteredService
import org.jasig.services.persondir.support.StubPersonAttributeDao; //导入依赖的package包/类
public static AbstractRegisteredService getRegisteredService(final String id) {
try {
final RegexRegisteredService s = new RegexRegisteredService();
s.setServiceId(id);
s.setEvaluationOrder(1);
s.setName("Test registered service");
s.setDescription("Registered service description");
s.setProxyPolicy(new RegexMatchingRegisteredServiceProxyPolicy("^https?://.+"));
s.setId(new SecureRandom().nextInt(Math.abs(s.hashCode())));
s.setTheme("exampleTheme");
s.setUsernameAttributeProvider(new PrincipalAttributeRegisteredServiceUsernameProvider("uid"));
final DefaultRegisteredServiceAccessStrategy accessStrategy =
new DefaultRegisteredServiceAccessStrategy(true, true);
accessStrategy.setRequireAllAttributes(true);
accessStrategy.setRequiredAttributes(getTestAttributes());
s.setAccessStrategy(accessStrategy);
s.setLogo(new URL("https://logo.example.org/logo.png"));
s.setLogoutType(LogoutType.BACK_CHANNEL);
s.setLogoutUrl(new URL("https://sys.example.org/logout.png"));
s.setProxyPolicy(new RegexMatchingRegisteredServiceProxyPolicy("^http.+"));
s.setPublicKey(new RegisteredServicePublicKeyImpl("classpath:pub.key", "RSA"));
final ReturnAllowedAttributeReleasePolicy policy = new ReturnAllowedAttributeReleasePolicy();
policy.setAuthorizedToReleaseCredentialPassword(true);
policy.setAuthorizedToReleaseProxyGrantingTicket(true);
final CachingPrincipalAttributesRepository repo =
new CachingPrincipalAttributesRepository(new StubPersonAttributeDao(), 10);
repo.setMergingStrategy(new NoncollidingAttributeAdder());
policy.setPrincipalAttributesRepository(repo);
policy.setAttributeFilter(new RegisteredServiceRegexAttributeFilter("https://.+"));
policy.setAllowedAttributes(new ArrayList(getTestAttributes().keySet()));
s.setAttributeReleasePolicy(policy);
return s;
} catch (final Exception e) {
throw new RuntimeException(e);
}
}
开发者ID:hsj-xiaokang,项目名称:springboot-shiro-cas-mybatis,代码行数:41,代码来源:TestUtils.java
示例7: verifySaveAttributeReleasePolicyAllowedAttrRulesWithCaching
import org.jasig.services.persondir.support.StubPersonAttributeDao; //导入依赖的package包/类
@Test
public void verifySaveAttributeReleasePolicyAllowedAttrRulesWithCaching() {
final RegisteredServiceImpl r = new RegisteredServiceImpl();
r.setName("testSaveAttributeReleasePolicyAllowedAttrRulesWithCaching");
r.setServiceId("testId");
final ReturnAllowedAttributeReleasePolicy policy = new ReturnAllowedAttributeReleasePolicy();
policy.setAllowedAttributes(Arrays.asList("1", "2", "3"));
final Map<String, List<Object>> attributes = new HashMap<>();
attributes.put("values", Arrays.asList(new Object[]{"v1", "v2", "v3"}));
final CachingPrincipalAttributesRepository repository =
new CachingPrincipalAttributesRepository(
new StubPersonAttributeDao(attributes),
TimeUnit.MILLISECONDS, 100);
repository.setMergingStrategy(new ReplacingAttributeAdder());
policy.setPrincipalAttributesRepository(repository);
r.setAttributeReleasePolicy(policy);
final RegisteredService r2 = this.dao.save(r);
final RegisteredService r3 = this.dao.findServiceById(r2.getId());
assertEquals(r, r2);
assertEquals(r2, r3);
assertNotNull(r3.getAttributeReleasePolicy());
assertEquals(r2.getAttributeReleasePolicy(), r3.getAttributeReleasePolicy());
}
开发者ID:hsj-xiaokang,项目名称:springboot-shiro-cas-mybatis,代码行数:30,代码来源:JsonServiceRegistryDaoTests.java
示例8: setUp
import org.jasig.services.persondir.support.StubPersonAttributeDao; //导入依赖的package包/类
@Before
public void setUp() throws Exception {
final Map<String, List<Object>> attributes = new HashMap<>();
attributes.put("test", Arrays.asList(new Object[] {"test"}));
this.repository = new StubPersonAttributeDao();
this.repository.setBackingMap(attributes);
this.manager = new DefaultServicesManagerImpl(
new InMemoryServiceRegistryDaoImpl());
this.controller = new RegisteredServiceSimpleFormController(
this.manager, this.repository);
}
开发者ID:hsj-xiaokang,项目名称:springboot-shiro-cas-mybatis,代码行数:15,代码来源:RegisteredServiceSimpleFormControllerTests.java
示例9: getAttributeRepository
import org.jasig.services.persondir.support.StubPersonAttributeDao; //导入依赖的package包/类
public static IPersonAttributeDao getAttributeRepository() {
final Map<String, List<Object>> attributes = new HashMap<String, List<Object>>();
attributes.put("uid", (List) Arrays.asList(CONST_USERNAME));
attributes.put("cn", (List) Arrays.asList(CONST_USERNAME.toUpperCase()));
attributes.put("givenName", (List) Arrays.asList(CONST_USERNAME));
attributes.put("memberOf", (List) Arrays.asList("system", "admin", "cas"));
return new StubPersonAttributeDao(attributes);
}
开发者ID:luotuo,项目名称:cas4.0.x-server-wechat,代码行数:9,代码来源:TestUtils.java
注:本文中的org.jasig.services.persondir.support.StubPersonAttributeDao类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论