• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

Java XMLObjectBuilderFactory类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

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



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

示例1: buildAndStoreSOAPMessage

import org.opensaml.core.xml.XMLObjectBuilderFactory; //导入依赖的package包/类
@Override
protected void buildAndStoreSOAPMessage(final XMLObject payload) {
    final XMLObjectBuilderFactory builderFactory = XMLObjectProviderRegistrySupport.getBuilderFactory();

    final SOAPObjectBuilder<Envelope> envBuilder =
            (SOAPObjectBuilder<Envelope>) builderFactory.getBuilder(Envelope.DEFAULT_ELEMENT_NAME);
    final Envelope envelope = envBuilder.buildObject(
            SOAPConstants.SOAP11_NS, Envelope.DEFAULT_ELEMENT_LOCAL_NAME, OPENSAML_11_SOAP_NS_PREFIX);

    final SOAPObjectBuilder<Body> bodyBuilder =
            (SOAPObjectBuilder<Body>) builderFactory.getBuilder(Body.DEFAULT_ELEMENT_NAME);
    final Body body = bodyBuilder.buildObject(
            SOAPConstants.SOAP11_NS, Body.DEFAULT_ELEMENT_LOCAL_NAME, OPENSAML_11_SOAP_NS_PREFIX);

    if(!body.getUnknownXMLObjects().isEmpty()) {
        LOGGER.warn("Existing SOAP Envelope Body already contained children");
    }

    body.getUnknownXMLObjects().add(payload);
    envelope.setBody(body);
    this.storeSOAPEnvelope(envelope);
}
 
开发者ID:hsj-xiaokang,项目名称:springboot-shiro-cas-mybatis,代码行数:23,代码来源:CasHttpSoap11Encoder.java


示例2: buildAndStoreSOAPMessage

import org.opensaml.core.xml.XMLObjectBuilderFactory; //导入依赖的package包/类
@Override
protected void buildAndStoreSOAPMessage(final XMLObject payload) {
    final XMLObjectBuilderFactory builderFactory = XMLObjectProviderRegistrySupport.getBuilderFactory();

    final SOAPObjectBuilder<Envelope> envBuilder =
            (SOAPObjectBuilder<Envelope>) builderFactory.getBuilder(Envelope.DEFAULT_ELEMENT_NAME);
    final Envelope envelope = envBuilder.buildObject(
            SOAPConstants.SOAP11_NS, Envelope.DEFAULT_ELEMENT_LOCAL_NAME, OPENSAML_11_SOAP_NS_PREFIX);

    final SOAPObjectBuilder<Body> bodyBuilder =
            (SOAPObjectBuilder<Body>) builderFactory.getBuilder(Body.DEFAULT_ELEMENT_NAME);
    final Body body = bodyBuilder.buildObject(
            SOAPConstants.SOAP11_NS, Body.DEFAULT_ELEMENT_LOCAL_NAME, OPENSAML_11_SOAP_NS_PREFIX);

    if (!body.getUnknownXMLObjects().isEmpty()) {
        LOGGER.warn("Existing SOAP Envelope Body already contained children");
    }

    body.getUnknownXMLObjects().add(payload);
    envelope.setBody(body);
    this.storeSOAPEnvelope(envelope);
}
 
开发者ID:mrluo735,项目名称:cas-5.1.0,代码行数:23,代码来源:CasHttpSoap11Encoder.java


示例3: createVerifiedAttribute

import org.opensaml.core.xml.XMLObjectBuilderFactory; //导入依赖的package包/类
public static Attribute createVerifiedAttribute(String name, boolean value) {
    Attribute attribute = new OpenSamlXmlObjectFactory().createAttribute();
    attribute.setName(name);

    XMLObjectBuilderFactory builderFactory = XMLObjectProviderRegistrySupport.getBuilderFactory();
    Verified verifiedValue = (Verified) builderFactory.getBuilder(Verified.TYPE_NAME).buildObject(Verified.DEFAULT_ELEMENT_NAME, Verified.TYPE_NAME);
    verifiedValue.setValue(value);

    attribute.getAttributeValues().add(verifiedValue);

    return attribute;
}
 
开发者ID:alphagov,项目名称:verify-service-provider,代码行数:13,代码来源:SamlResponseHelper.java


示例4: createSamlObject

import org.opensaml.core.xml.XMLObjectBuilderFactory; //导入依赖的package包/类
/**
 * Utility method for creating an OpenSAML object given its element name.
 * 
 * @param clazz
 *          the class to create
 * @param elementName
 *          the element name for the XML object to create
 * @return the XML object
 */
public static <T extends XMLObject> T createSamlObject(Class<T> clazz, QName elementName) {
  if (!XMLObject.class.isAssignableFrom(clazz)) {
    throw new RuntimeException(String.format("%s is not a XMLObject class", clazz.getName()));
  }
  XMLObjectBuilderFactory builderFactory = XMLObjectProviderRegistrySupport.getBuilderFactory();
  XMLObjectBuilder<? extends XMLObject> builder = builderFactory.getBuilder(elementName);
  if (builder == null) {
    // No builder registered for the given element name. Try creating a builder for the default element name.
    builder = builderFactory.getBuilder(getDefaultElementName(clazz));
  }
  Object object = builder.buildObject(elementName);
  return clazz.cast(object);
}
 
开发者ID:litsec,项目名称:eidas-opensaml,代码行数:23,代码来源:OpenSAMLTestBase.java


示例5: testMarshallAndUnmarshallStructured

import org.opensaml.core.xml.XMLObjectBuilderFactory; //导入依赖的package包/类
/**
 * Tests marshalling and unmarshalling of {@code CurrentAddressStructuredType}.
 * 
 * @throws Exception
 *           for errors
 */
@Test
public void testMarshallAndUnmarshallStructured() throws Exception {

  XMLObjectBuilderFactory builderFactory = XMLObjectProviderRegistrySupport.getBuilderFactory();

  Object object = builderFactory.getBuilder(CurrentAddressStructuredType.TYPE_NAME).buildObject(CurrentAddressStructuredType.TYPE_NAME
    .getNamespaceURI(), CurrentAddressStructuredType.TYPE_NAME.getLocalPart(), "eidas");
  CurrentAddressStructuredType address = CurrentAddressStructuredType.class.cast(object);

  fill(address);

  // Marshall
  Element element = OpenSAMLTestBase.marshall(address);
  Assert.assertNotNull(element);

  // Unmarshall element
  CurrentAddressStructuredType address2 = OpenSAMLTestBase.unmarshall(element, CurrentAddressStructuredType.class);

  verify(address, address2);

  // Test unmarshall again
  String xml = SerializeSupport.prettyPrintXML(element);
  Document doc = XMLObjectProviderRegistrySupport.getParserPool().parse(new ByteArrayInputStream(xml.toString().getBytes("UTF-8")));

  CurrentAddressStructuredType address3 = OpenSAMLTestBase.unmarshall(doc.getDocumentElement(), CurrentAddressStructuredType.class);
  verify(address, address3);
}
 
开发者ID:litsec,项目名称:eidas-opensaml,代码行数:34,代码来源:CurrentAddressTypeTest.java


示例6: testMarshallAndUnmarshall

import org.opensaml.core.xml.XMLObjectBuilderFactory; //导入依赖的package包/类
/**
 * Tests marshalling and unmarshalling of {@code CurrentAddressType}.
 * 
 * @throws Exception
 *           for errors
 */
@Test
public void testMarshallAndUnmarshall() throws Exception {

  XMLObjectBuilderFactory builderFactory = XMLObjectProviderRegistrySupport.getBuilderFactory();

  Object object = builderFactory.getBuilder(CurrentAddressType.TYPE_NAME).buildObject(CurrentAddressType.TYPE_NAME.getNamespaceURI(),
    CurrentAddressType.TYPE_NAME.getLocalPart(), "eidas");
  CurrentAddressType address = CurrentAddressType.class.cast(object);

  fill(address);

  // Marshall
  Element element = OpenSAMLTestBase.marshall(address);
  Assert.assertNotNull(element);

  // Verify that we got one child element that is the Base64 encoding.
  NodeList childs = element.getChildNodes();
  Assert.assertEquals(1, childs.getLength());
  String base64 = childs.item(0).getNodeValue();
  byte[] bytes = Base64Support.decode(base64);
  Assert.assertTrue((new String(bytes)).startsWith("<eidas:"));

  // Unmarshall element
  CurrentAddressType address2 = OpenSAMLTestBase.unmarshall(element, CurrentAddressType.class);

  verify(address, address2);
  
  String swedishEidString = address2.toSwedishEidString();
  Assert.assertEquals("LocatorDesignator=6%20tr;LocatorName=10;Thoroughfare=Korta%20gatan;PostName=Solna;PostCode=19174", swedishEidString);

  // Test unmarshall again
  String xml = SerializeSupport.prettyPrintXML(element);
  Document doc = XMLObjectProviderRegistrySupport.getParserPool().parse(new ByteArrayInputStream(xml.toString().getBytes("UTF-8")));

  CurrentAddressType address3 = OpenSAMLTestBase.unmarshall(doc.getDocumentElement(), CurrentAddressType.class);
  verify(address, address3);

}
 
开发者ID:litsec,项目名称:eidas-opensaml,代码行数:45,代码来源:CurrentAddressTypeTest.java


示例7: getBuilderFactory

import org.opensaml.core.xml.XMLObjectBuilderFactory; //导入依赖的package包/类
public XMLObjectBuilderFactory getBuilderFactory() {
    return builderFactory;
}
 
开发者ID:hsj-xiaokang,项目名称:springboot-shiro-cas-mybatis,代码行数:4,代码来源:OpenSamlConfigBean.java


示例8: getBuilderFactory

import org.opensaml.core.xml.XMLObjectBuilderFactory; //导入依赖的package包/类
public XMLObjectBuilderFactory getBuilderFactory() {
    return this.builderFactory;
}
 
开发者ID:mrluo735,项目名称:cas-5.1.0,代码行数:4,代码来源:OpenSamlConfigBean.java


示例9: builderFactory

import org.opensaml.core.xml.XMLObjectBuilderFactory; //导入依赖的package包/类
@Bean(name = "shibboleth.BuilderFactory")
@DependsOn("shibboleth.OpenSAMLConfig")
public XMLObjectBuilderFactory builderFactory() {
    return XMLObjectProviderRegistrySupport.getBuilderFactory();
}
 
开发者ID:mrluo735,项目名称:cas-5.1.0,代码行数:6,代码来源:CoreSamlConfiguration.java


示例10: getBuilderFactory

import org.opensaml.core.xml.XMLObjectBuilderFactory; //导入依赖的package包/类
public static XMLObjectBuilderFactory getBuilderFactory() {
    return XMLObjectProviderRegistrySupport.getBuilderFactory();
}
 
开发者ID:yaochi,项目名称:pac4j-plus,代码行数:4,代码来源:Configuration.java


示例11: createEntityDescriptor

import org.opensaml.core.xml.XMLObjectBuilderFactory; //导入依赖的package包/类
private EntityDescriptor createEntityDescriptor(String entityId) {
    XMLObjectBuilderFactory openSamlBuilderFactory = XMLObjectProviderRegistrySupport.getBuilderFactory();
    EntityDescriptor entityDescriptor = (EntityDescriptor) openSamlBuilderFactory.getBuilder(EntityDescriptor.TYPE_NAME).buildObject(EntityDescriptor.DEFAULT_ELEMENT_NAME, EntityDescriptor.TYPE_NAME);
    entityDescriptor.setEntityID(entityId);
    return entityDescriptor;
}
 
开发者ID:alphagov,项目名称:verify-matching-service-adapter,代码行数:7,代码来源:MatchingServiceAdapterMetadataRepository.java



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
Java OnItemChildClickListener类代码示例发布时间:2022-05-22
下一篇:
Java TransformationException类代码示例发布时间:2022-05-22
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap