本文整理汇总了Java中net.shibboleth.utilities.java.support.xml.BasicParserPool类的典型用法代码示例。如果您正苦于以下问题:Java BasicParserPool类的具体用法?Java BasicParserPool怎么用?Java BasicParserPool使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
BasicParserPool类属于net.shibboleth.utilities.java.support.xml包,在下文中一共展示了BasicParserPool类的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。
示例1: initializeMetadata
import net.shibboleth.utilities.java.support.xml.BasicParserPool; //导入依赖的package包/类
private MetadataResolver initializeMetadata() {
try {
InitializationService.initialize();
String content = new MetadataFactory().defaultMetadata();
StringBackedMetadataResolver metadataResolver = new StringBackedMetadataResolver(content);
BasicParserPool pool = new BasicParserPool();
pool.initialize();
metadataResolver.setParserPool(pool);
metadataResolver.setId("testResolver");
metadataResolver.setResolveViaPredicatesOnly(true);
metadataResolver.setRequireValidMetadata(true);
EntityDescriptorCriterionPredicateRegistry registry = new EntityDescriptorCriterionPredicateRegistry();
registry.register(EntitiesDescriptorNameCriterion.class, EntitiesDescriptorNamePredicate.class);
metadataResolver.setCriterionPredicateRegistry(registry);
metadataResolver.initialize();
return metadataResolver;
} catch (ComponentInitializationException | InitializationException e) {
throw propagate(e);
}
}
开发者ID:alphagov,项目名称:verify-hub,代码行数:21,代码来源:HubAsIdpMetadataHandlerTest.java
示例2: shouldBeAbleToLoadMSAMetadataUsingMetadataResolver
import net.shibboleth.utilities.java.support.xml.BasicParserPool; //导入依赖的package包/类
@Test
public void shouldBeAbleToLoadMSAMetadataUsingMetadataResolver() throws Exception {
when(matchingServiceAdapterConfiguration.shouldRepublishHubCertificates()).thenReturn(true);
Document matchingServiceAdapterMetadata = matchingServiceAdapterMetadataRepository.getMatchingServiceAdapterMetadata();
String metadata = XmlUtils.writeToString(matchingServiceAdapterMetadata);
StringBackedMetadataResolver stringBackedMetadataResolver = new StringBackedMetadataResolver(metadata);
BasicParserPool pool = new BasicParserPool();
pool.initialize();
stringBackedMetadataResolver.setParserPool(pool);
stringBackedMetadataResolver.setId("Some ID");
stringBackedMetadataResolver.initialize();
assertThat(stringBackedMetadataResolver.resolveSingle(new CriteriaSet(new EntityIdCriterion(entityId))).getEntityID()).isEqualTo(entityId);
assertThat(stringBackedMetadataResolver.resolveSingle(new CriteriaSet(new EntityIdCriterion(TestEntityIds.HUB_ENTITY_ID))).getEntityID()).isEqualTo(TestEntityIds.HUB_ENTITY_ID);
}
开发者ID:alphagov,项目名称:verify-matching-service-adapter,代码行数:18,代码来源:MatchingServiceAdapterMetadataRepositoryTest.java
示例3: parserPool
import net.shibboleth.utilities.java.support.xml.BasicParserPool; //导入依赖的package包/类
@Bean(name = "shibboleth.ParserPool", initMethod = "initialize")
public BasicParserPool parserPool() {
final BasicParserPool pool = new BasicParserPool();
pool.setMaxPoolSize(POOL_SIZE);
pool.setCoalescing(true);
pool.setIgnoreComments(true);
pool.setXincludeAware(false);
pool.setExpandEntityReferences(false);
pool.setIgnoreComments(true);
pool.setNamespaceAware(true);
final Map<String, Object> attributes = new HashMap<>();
try {
final Class clazz = ClassUtils.getClass(casProperties.getSamlCore().getSecurityManager());
attributes.put("http://apache.org/xml/properties/security-manager", clazz.newInstance());
} catch (final Exception e) {
throw Throwables.propagate(e);
}
pool.setBuilderAttributes(attributes);
final Map<String, Boolean> features = new HashMap<>();
features.put("http://apache.org/xml/features/disallow-doctype-decl", Boolean.TRUE);
features.put("http://apache.org/xml/features/validation/schema/normalized-value",
Boolean.FALSE);
features.put("http://javax.xml.XMLConstants/feature/secure-processing",
Boolean.TRUE);
features.put("http://xml.org/sax/features/external-general-entities",
Boolean.FALSE);
features.put("http://xml.org/sax/features/external-parameter-entities",
Boolean.FALSE);
pool.setBuilderFeatures(features);
return pool;
}
开发者ID:mrluo735,项目名称:cas-5.1.0,代码行数:34,代码来源:CoreSamlConfiguration.java
示例4: initialiseResolver
import net.shibboleth.utilities.java.support.xml.BasicParserPool; //导入依赖的package包/类
private void initialiseResolver() {
try {
BasicParserPool parserPool = new BasicParserPool();
parserPool.initialize();
this.setParserPool(parserPool);
this.setId("dynamic-resolver!");
this.initialize();
} catch (ComponentInitializationException e) {
throw propagate(e);
}
}
开发者ID:alphagov,项目名称:verify-hub,代码行数:12,代码来源:EidasMetadataResolver.java
示例5: shouldGenerateValidMetadataFromLocalConfiguration
import net.shibboleth.utilities.java.support.xml.BasicParserPool; //导入依赖的package包/类
@Test
public void shouldGenerateValidMetadataFromLocalConfiguration() throws Exception {
HTTPMetadataResolver httpMetadataResolver = new HTTPMetadataResolver(new Timer(), HttpClientBuilder.create().build(),
"http://localhost:" + applicationRule.getLocalPort() + "/matching-service/SAML2/metadata");
BasicParserPool basicParserPool = new BasicParserPool();
basicParserPool.initialize();
httpMetadataResolver.setParserPool(basicParserPool);
httpMetadataResolver.setId("test id");
httpMetadataResolver.initialize();
httpMetadataResolver.refresh();
EntityDescriptor descriptor = httpMetadataResolver.resolveSingle(new CriteriaSet(new EntityIdCriterion(TEST_RP_MS)));
AttributeAuthorityDescriptor attributeAuthorityDescriptor = descriptor.getAttributeAuthorityDescriptor(SAMLConstants.SAML20P_NS);
Map<UsageType, List<KeyDescriptor>> keysByUsage = attributeAuthorityDescriptor.getKeyDescriptors().stream()
.collect(groupingBy(KeyDescriptor::getUse));
assertThat(keysByUsage.get(UsageType.SIGNING)).hasSize(2);
assertThat(keysByUsage.get(UsageType.ENCRYPTION)).hasSize(1);
assertThat(getCertificateNames(keysByUsage, UsageType.SIGNING)).contains(MSA_SIGNING_PRIMARY, MSA_SIGNING_SECONDARY);
assertThat(getCertificateNames(keysByUsage, UsageType.ENCRYPTION)).contains(MSA_ENCRYPTION_PRIMARY);
IDPSSODescriptor idpssoDescriptor = descriptor.getIDPSSODescriptor(SAMLConstants.SAML20P_NS);
assertThat(idpssoDescriptor).isNotNull();
assertThat(idpssoDescriptor.getSingleSignOnServices()).hasSize(1);
keysByUsage = idpssoDescriptor.getKeyDescriptors().stream().collect(groupingBy(KeyDescriptor::getUse));
assertThat(keysByUsage.get(UsageType.SIGNING)).hasSize(2);
assertThat(getCertificateNames(keysByUsage, UsageType.SIGNING)).contains(MSA_SIGNING_PRIMARY, MSA_SIGNING_SECONDARY);
}
开发者ID:alphagov,项目名称:verify-matching-service-adapter,代码行数:33,代码来源:MatchingServiceAdapterMetadataAppRuleTest.java
注:本文中的net.shibboleth.utilities.java.support.xml.BasicParserPool类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论