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


Java XMLObjectBuilderFactory.getBuilder方法代码示例

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


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

示例1: buildSOAPMessage

import org.opensaml.xml.XMLObjectBuilderFactory; //导入方法依赖的package包/类
@Override
protected Envelope buildSOAPMessage(final SAMLObject samlMessage) {
    final XMLObjectBuilderFactory builderFactory = Configuration.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);

    body.getUnknownXMLObjects().add(samlMessage);
    envelope.setBody(body);

    return envelope;
}
 
开发者ID:luotuo,项目名称:cas4.0.x-server-wechat,代码行数:20,代码来源:CasHTTPSOAP11Encoder.java

示例2: Encrypter

import org.opensaml.xml.XMLObjectBuilderFactory; //导入方法依赖的package包/类
/**
 * Constructor.
 * 
 */
public Encrypter() {
    UnmarshallerFactory unmarshallerFactory = Configuration.getUnmarshallerFactory();
    encryptedDataUnmarshaller = unmarshallerFactory.getUnmarshaller(EncryptedData.DEFAULT_ELEMENT_NAME);
    encryptedKeyUnmarshaller = unmarshallerFactory.getUnmarshaller(EncryptedKey.DEFAULT_ELEMENT_NAME);

    XMLObjectBuilderFactory builderFactory = Configuration.getBuilderFactory();
    keyInfoBuilder = (XMLSignatureBuilder<KeyInfo>) builderFactory.getBuilder(KeyInfo.DEFAULT_ELEMENT_NAME);

    jcaProviderName = null;
}
 
开发者ID:lamsfoundation,项目名称:lams,代码行数:15,代码来源:Encrypter.java

示例3: buildSOAPMessage

import org.opensaml.xml.XMLObjectBuilderFactory; //导入方法依赖的package包/类
/**
 * Builds the SOAP message to be encoded.
 * 
 * @param samlMessage body of the SOAP message
 * 
 * @return the SOAP message
 */
@SuppressWarnings("unchecked")
protected Envelope buildSOAPMessage(SAMLObject samlMessage) {
    log.debug("Building SOAP message");
    XMLObjectBuilderFactory builderFactory = Configuration.getBuilderFactory();

    SOAPObjectBuilder<Envelope> envBuilder = (SOAPObjectBuilder<Envelope>) builderFactory
            .getBuilder(Envelope.DEFAULT_ELEMENT_NAME);
    Envelope envelope = envBuilder.buildObject();

    log.debug("Adding SAML message to the SOAP message's body");
    SOAPObjectBuilder<Body> bodyBuilder = (SOAPObjectBuilder<Body>) builderFactory
            .getBuilder(Body.DEFAULT_ELEMENT_NAME);
    Body body = bodyBuilder.buildObject();
    body.getUnknownXMLObjects().add(samlMessage);
    envelope.setBody(body);

    return envelope;
}
 
开发者ID:lamsfoundation,项目名称:lams,代码行数:26,代码来源:HTTPSOAP11Encoder.java

示例4: buildSOAPMessage

import org.opensaml.xml.XMLObjectBuilderFactory; //导入方法依赖的package包/类
/**
 * Builds the SOAP message to be encoded.
 * 
 * @param samlMessage body of the SOAP message
 * 
 * @return the SOAP message
 */
@SuppressWarnings("unchecked")
protected Envelope buildSOAPMessage(SAMLObject samlMessage) {
    if (log.isDebugEnabled()) {
        log.debug("Building SOAP message");
    }
    XMLObjectBuilderFactory builderFactory = Configuration.getBuilderFactory();

    SOAPObjectBuilder<Envelope> envBuilder = (SOAPObjectBuilder<Envelope>) builderFactory
            .getBuilder(Envelope.DEFAULT_ELEMENT_NAME);
    Envelope envelope = envBuilder.buildObject();

    if (log.isDebugEnabled()) {
        log.debug("Adding SAML message to the SOAP message's body");
    }
    SOAPObjectBuilder<Body> bodyBuilder = (SOAPObjectBuilder<Body>) builderFactory
            .getBuilder(Body.DEFAULT_ELEMENT_NAME);
    Body body = bodyBuilder.buildObject();
    body.getUnknownXMLObjects().add(samlMessage);
    envelope.setBody(body);

    return envelope;
}
 
开发者ID:lamsfoundation,项目名称:lams,代码行数:30,代码来源:HTTPSOAP11Encoder.java

示例5: SOAP11Encoder

import org.opensaml.xml.XMLObjectBuilderFactory; //导入方法依赖的package包/类
/** Constructor. */
@SuppressWarnings("unchecked")
public SOAP11Encoder() {
    super();
    XMLObjectBuilderFactory builderFactory = Configuration.getBuilderFactory();
    envBuilder = (SOAPObjectBuilder<Envelope>) builderFactory.getBuilder(Envelope.DEFAULT_ELEMENT_NAME);
    bodyBuilder = (SOAPObjectBuilder<Body>) builderFactory.getBuilder(Body.DEFAULT_ELEMENT_NAME);
}
 
开发者ID:lamsfoundation,项目名称:lams,代码行数:9,代码来源:SOAP11Encoder.java

示例6: HandlerChainAwareHTTPSOAP11Encoder

import org.opensaml.xml.XMLObjectBuilderFactory; //导入方法依赖的package包/类
/** Constructor. */
public HandlerChainAwareHTTPSOAP11Encoder() {
    super();
    XMLObjectBuilderFactory builderFactory = Configuration.getBuilderFactory();
    envBuilder = (SOAPObjectBuilder<Envelope>) builderFactory.getBuilder(Envelope.DEFAULT_ELEMENT_NAME);
    bodyBuilder = (SOAPObjectBuilder<Body>) builderFactory.getBuilder(Body.DEFAULT_ELEMENT_NAME);
}
 
开发者ID:lamsfoundation,项目名称:lams,代码行数:8,代码来源:HandlerChainAwareHTTPSOAP11Encoder.java

示例7: createSamlObject

import org.opensaml.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 = Configuration.getBuilderFactory();
  XMLObjectBuilder<?> 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

示例8: getMetadata

import org.opensaml.xml.XMLObjectBuilderFactory; //导入方法依赖的package包/类
/**
 * Gets the metadata from every registered provider and places each within a newly created EntitiesDescriptor.
 * 
 * {@inheritDoc}
 */
public XMLObject getMetadata() throws MetadataProviderException {
    XMLObjectBuilderFactory builderFactory = Configuration.getBuilderFactory();
    SAMLObjectBuilder<EntitiesDescriptor> builder = (SAMLObjectBuilder<EntitiesDescriptor>) builderFactory
            .getBuilder(EntitiesDescriptor.DEFAULT_ELEMENT_NAME);
    EntitiesDescriptor metadataRoot = builder.buildObject();

    Lock readLock = providerLock.readLock();
    readLock.lock();

    XMLObject providerMetadata;
    try {
        for (MetadataProvider provider : providers) {
            providerMetadata = provider.getMetadata();
            if (providerMetadata instanceof EntitiesDescriptor) {
                metadataRoot.getEntitiesDescriptors().add((EntitiesDescriptor) providerMetadata);
            } else if (providerMetadata instanceof EntityDescriptor) {
                metadataRoot.getEntityDescriptors().add((EntityDescriptor) providerMetadata);
            }
        }
    } catch (MetadataProviderException e) {
        throw e;
    } finally {
        readLock.unlock();
    }

    return metadataRoot;
}
 
开发者ID:apigee,项目名称:java-opensaml2,代码行数:33,代码来源:ChainingMetadataProvider.java

示例9: createStatement

import org.opensaml.xml.XMLObjectBuilderFactory; //导入方法依赖的package包/类
@Override
public void createStatement(GenericIdentityProviderData ipData, RahasData rahasData)
        throws IdentityProviderException {
    if (log.isDebugEnabled()) {
        log.debug("Begin SAML statement creation.");
    }
    attributeStmt = (AttributeStatement) buildXMLObject(AttributeStatement.DEFAULT_ELEMENT_NAME);

    Map<String, RequestedClaimData> mapClaims = ipData.getRequestedClaims();

    if (rahasData.getAppliesToAddress() != null) {
        appilesTo = rahasData.getAppliesToAddress();
    }

    Iterator<RequestedClaimData> ite = mapClaims.values().iterator();

    while (ite.hasNext()) {
        RequestedClaimData claim = ite.next();
        String uri = claim.getUri();

        int index = uri.lastIndexOf("/");
        String attrName = uri.substring(index + 1, uri.length());
        String attrNamespace = uri.substring(0, index);

        Attribute attribute = (Attribute) buildXMLObject(Attribute.DEFAULT_ELEMENT_NAME);
        attribute.setName(attrName);
        attribute.setNameFormat(attrNamespace);

        XMLObjectBuilderFactory builderFactory = Configuration.getBuilderFactory();

        // TODO remove this else if condition after WSO2 IS supports claim
        // types properly
        if (claim.getUri().equals(IdentityConstants.CLAIM_PPID)) {
            XSBase64BinaryBuilder ppidValueBuilder = (XSBase64BinaryBuilder) builderFactory
                    .getBuilder(XSBase64Binary.TYPE_NAME);
            XSBase64Binary ppidValue = ppidValueBuilder.buildObject(
                    AttributeValue.DEFAULT_ELEMENT_NAME, XSBase64Binary.TYPE_NAME);
            ppidValue.setValue(claim.getValue());
            attribute.getAttributeValues().add(ppidValue);
        } else {
            XSStringBuilder attributeValueBuilder = (XSStringBuilder) builderFactory
                    .getBuilder(XSString.TYPE_NAME);

            XSString stringValue = attributeValueBuilder.buildObject(
                    AttributeValue.DEFAULT_ELEMENT_NAME, XSString.TYPE_NAME);
            stringValue.setValue(claim.getValue());
            attribute.getAttributeValues().add(stringValue);
        }
        attributeStmt.getAttributes().add(attribute);
    }
}
 
开发者ID:wso2-attic,项目名称:carbon-identity,代码行数:52,代码来源:SAML2TokenBuilder.java

示例10: createStatement

import org.opensaml.xml.XMLObjectBuilderFactory; //导入方法依赖的package包/类
@Override
public void createStatement(GenericIdentityProviderData ipData, RahasData rahasData)
        throws IdentityProviderException {
    if (log.isDebugEnabled()) {
        log.debug("Begin SAML statement creation.");
    }
    attributeStmt = (AttributeStatement) buildXMLObject(AttributeStatement.DEFAULT_ELEMENT_NAME);

    Subject subject = (Subject) buildXMLObject(Subject.DEFAULT_ELEMENT_NAME);
    SubjectConfirmation subjectConf =
            (SubjectConfirmation) buildXMLObject(SubjectConfirmation.DEFAULT_ELEMENT_NAME);
    ConfirmationMethod confMethod = (ConfirmationMethod) buildXMLObject(ConfirmationMethod.DEFAULT_ELEMENT_NAME);
    confMethod.setConfirmationMethod(CONF_KEY);
    subjectConf.getConfirmationMethods().add(confMethod);
    subject.setSubjectConfirmation(subjectConf);

    attributeStmt.setSubject(subject);

    Map<String, RequestedClaimData> mapClaims = ipData.getRequestedClaims();

    if (rahasData.getAppliesToAddress() != null) {
        appilesTo = rahasData.getAppliesToAddress();
    }

    Iterator<RequestedClaimData> ite = mapClaims.values().iterator();

    while (ite.hasNext()) {
        RequestedClaimData claim = ite.next();
        String uri = claim.getUri();

        int index = uri.lastIndexOf("/");
        String attrName = uri.substring(index + 1, uri.length());
        String attrNamespace = uri.substring(0, index);

        Attribute attribute = (Attribute) buildXMLObject(Attribute.DEFAULT_ELEMENT_NAME);
        attribute.setAttributeName(attrName);
        attribute.setAttributeNamespace(attrNamespace);

        XMLObjectBuilderFactory builderFactory = Configuration.getBuilderFactory();
        XSStringBuilder attributeValueBuilder = (XSStringBuilder) builderFactory.getBuilder(XSString.TYPE_NAME);

        XSString stringValue =
                attributeValueBuilder.buildObject(AttributeValue.DEFAULT_ELEMENT_NAME, XSString.TYPE_NAME);
        stringValue.setValue(claim.getValue());
        attribute.getAttributeValues().add(stringValue);

        attributeStmt.getAttributes().add(attribute);
    }
}
 
开发者ID:wso2-attic,项目名称:carbon-identity,代码行数:50,代码来源:SAML1TokenBuilder.java

示例11: createAuthnRequest

import org.opensaml.xml.XMLObjectBuilderFactory; //导入方法依赖的package包/类
@SuppressWarnings("unchecked")
private String createAuthnRequest(String requestId)
    throws SAMLException
{
    XMLObjectBuilderFactory builderFactory = Configuration.getBuilderFactory();

    SAMLObjectBuilder<AuthnRequest> builder =
        (SAMLObjectBuilder<AuthnRequest>) builderFactory
        .getBuilder(AuthnRequest.DEFAULT_ELEMENT_NAME);

    SAMLObjectBuilder<Issuer> issuerBuilder =
        (SAMLObjectBuilder<Issuer>) builderFactory
        .getBuilder(Issuer.DEFAULT_ELEMENT_NAME);

    AuthnRequest request = builder.buildObject();
    request.setAssertionConsumerServiceURL(spConfig.getAcs().toString());
    request.setDestination(idpConfig.getLoginUrl().toString());
    request.setIssueInstant(new DateTime());
    request.setID(requestId);

    Issuer issuer = issuerBuilder.buildObject();
    issuer.setValue(spConfig.getEntityId());
    request.setIssuer(issuer);

    try {
        // samlobject to xml dom object
        Element elem = Configuration.getMarshallerFactory()
            .getMarshaller(request)
            .marshall(request);

        // and to a string...
        Document document = elem.getOwnerDocument();
        DOMImplementationLS domImplLS = (DOMImplementationLS) document
            .getImplementation();
        LSSerializer serializer = domImplLS.createLSSerializer();
        serializer.getDomConfig().setParameter("xml-declaration", false);
        return serializer.writeToString(elem);
    }
    catch (MarshallingException e) {
        throw new SAMLException(e);
    }
}
 
开发者ID:lastpass,项目名称:saml-sdk-java,代码行数:43,代码来源:SAMLClient.java


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