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


Java ReturnAllowedAttributeReleasePolicy类代码示例

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


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

示例1: verifyUpdatingServices

import org.jasig.cas.services.ReturnAllowedAttributeReleasePolicy; //导入依赖的package包/类
@Test
public void verifyUpdatingServices() {
    this.dao.save(getRegisteredService());
    final List<RegisteredService> services = this.dao.load();

    final AbstractRegisteredService rs = (AbstractRegisteredService) this.dao.findServiceById(services.get(0).getId());
    assertNotNull(rs);
    rs.setEvaluationOrder(9999);
    rs.setUsernameAttributeProvider(new DefaultRegisteredServiceUsernameProvider());
    rs.setName("Another Test Service");
    rs.setDescription("The new description");
    rs.setServiceId("https://hello.world");
    rs.setProxyPolicy(new RegexMatchingRegisteredServiceProxyPolicy("https"));
    rs.setAttributeReleasePolicy(new ReturnAllowedAttributeReleasePolicy());
    assertNotNull(this.dao.save(rs));

    final RegisteredService rs3 = this.dao.findServiceById(rs.getId());
    assertEquals(rs3.getName(), rs.getName());
    assertEquals(rs3.getDescription(), rs.getDescription());
    assertEquals(rs3.getEvaluationOrder(), rs.getEvaluationOrder());
    assertEquals(rs3.getUsernameAttributeProvider(), rs.getUsernameAttributeProvider());
    assertEquals(rs3.getProxyPolicy(), rs.getProxyPolicy());
    assertEquals(rs3.getUsernameAttributeProvider(), rs.getUsernameAttributeProvider());
    assertEquals(rs3.getServiceId(), rs.getServiceId());
}
 
开发者ID:hsj-xiaokang,项目名称:springboot-shiro-cas-mybatis,代码行数:26,代码来源:LdapServiceRegistryDaoTests.java

示例2: verifyServiceAttributeFilterAllowedAttributesWithARegexFilter

import org.jasig.cas.services.ReturnAllowedAttributeReleasePolicy; //导入依赖的package包/类
@Test
public void verifyServiceAttributeFilterAllowedAttributesWithARegexFilter() {
    final ReturnAllowedAttributeReleasePolicy policy = new ReturnAllowedAttributeReleasePolicy();
    policy.setAllowedAttributes(Arrays.asList("attr1", "attr3", "another"));
    policy.setAttributeFilter(new RegisteredServiceRegexAttributeFilter("v3"));
    final Principal p = mock(Principal.class);

    final Map<String, Object> map = new HashMap<>();
    map.put("attr1", "value1");
    map.put("attr2", "value2");
    map.put("attr3", Arrays.asList("v3", "v4"));

    when(p.getAttributes()).thenReturn(map);
    when(p.getId()).thenReturn("principalId");

    final Map<String, Object> attr = policy.getAttributes(p);
    assertEquals(attr.size(), 1);
    assertTrue(attr.containsKey("attr3"));

    final byte[] data = SerializationUtils.serialize(policy);
    final ReturnAllowedAttributeReleasePolicy p2 = SerializationUtils.deserialize(data);
    assertNotNull(p2);
    assertEquals(p2.getAllowedAttributes(), policy.getAllowedAttributes());
    assertEquals(p2.getAttributeFilter(), policy.getAttributeFilter());
}
 
开发者ID:hsj-xiaokang,项目名称:springboot-shiro-cas-mybatis,代码行数:26,代码来源:RegisteredServiceRegexAttributeFilterTests.java

示例3: write

import org.jasig.cas.services.ReturnAllowedAttributeReleasePolicy; //导入依赖的package包/类
@Override
public void write(final Kryo kryo, final Output output, final RegisteredService service) {
    kryo.writeObject(output, service.getServiceId());
    kryo.writeObject(output, StringUtils.defaultIfEmpty(service.getName(), ""));
    kryo.writeObject(output, StringUtils.defaultIfEmpty(service.getDescription(), ""));
    kryo.writeObject(output, service.getId());
    kryo.writeObject(output, service.getEvaluationOrder());
    kryo.writeObject(output, ObjectUtils.defaultIfNull(service.getLogo(), getEmptyUrl()));
    kryo.writeObject(output, service.getLogoutType());
    kryo.writeObject(output, ObjectUtils.defaultIfNull(service.getLogoutUrl(), getEmptyUrl()));
    kryo.writeObject(output, ImmutableSet.copyOf(service.getRequiredHandlers()));
    kryo.writeObject(output, StringUtils.defaultIfEmpty(service.getTheme(), ""));

    writeObjectByReflection(kryo, output, ObjectUtils.defaultIfNull(service.getPublicKey(),
            new RegisteredServicePublicKeyImpl()));
    writeObjectByReflection(kryo, output, ObjectUtils.defaultIfNull(service.getProxyPolicy(),
            new RefuseRegisteredServiceProxyPolicy()));
    writeObjectByReflection(kryo, output, ObjectUtils.defaultIfNull(service.getAttributeReleasePolicy(),
            new ReturnAllowedAttributeReleasePolicy()));
    writeObjectByReflection(kryo, output, ObjectUtils.defaultIfNull(service.getUsernameAttributeProvider(),
            new DefaultRegisteredServiceUsernameProvider()));
    writeObjectByReflection(kryo, output, ObjectUtils.defaultIfNull(service.getAccessStrategy(),
            new DefaultRegisteredServiceAccessStrategy()));
}
 
开发者ID:hsj-xiaokang,项目名称:springboot-shiro-cas-mybatis,代码行数:25,代码来源:RegisteredServiceSerializer.java

示例4: getRegisteredService

import org.jasig.cas.services.ReturnAllowedAttributeReleasePolicy; //导入依赖的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

示例5: getRegisteredService

import org.jasig.cas.services.ReturnAllowedAttributeReleasePolicy; //导入依赖的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(10);
        repo.setMergingStrategy(CachingPrincipalAttributesRepository.MergingStrategy.ADD);
        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:xuchengdong,项目名称:cas4.1.9,代码行数:41,代码来源:TestUtils.java


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