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


Java Configuration.getUnmarshallerFactory方法代码示例

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


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

示例1: unmarshall

import org.opensaml.Configuration; //导入方法依赖的package包/类
/**
 * Constructing the SAML or XACML Objects from a String
 *
 * @param xmlString Decoded SAML or XACML String
 * @return SAML or XACML Object
 * @throws org.wso2.carbon.identity.base.IdentityException
 */
public static XMLObject unmarshall(String xmlString) throws IdentityException {

    try {
        DocumentBuilderFactory documentBuilderFactory = getSecuredDocumentBuilderFactory();
        DocumentBuilder docBuilder = documentBuilderFactory.newDocumentBuilder();
        Document document = docBuilder.parse(new ByteArrayInputStream(xmlString.trim().getBytes(Charsets.UTF_8)));
        Element element = document.getDocumentElement();
        UnmarshallerFactory unmarshallerFactory = Configuration.getUnmarshallerFactory();
        Unmarshaller unmarshaller = unmarshallerFactory.getUnmarshaller(element);
        return unmarshaller.unmarshall(element);
    } catch (ParserConfigurationException | UnmarshallingException | SAXException | IOException e) {
        String message = "Error in constructing XML Object from the encoded String";
        throw IdentityException.error(message, e);
    }
}
 
开发者ID:wso2,项目名称:carbon-identity-framework,代码行数:23,代码来源:IdentityUtil.java

示例2: unmarshall

import org.opensaml.Configuration; //导入方法依赖的package包/类
/**
 * Constructing the SAML or XACML Objects from a String
 *
 * @param xmlString Decoded SAML or XACML String
 * @return SAML or XACML Object
 * @throws org.wso2.carbon.identity.entitlement.EntitlementException
 */
public XMLObject unmarshall(String xmlString) throws EntitlementException {

    try {
        doBootstrap();
        DocumentBuilderFactory documentBuilderFactory = IdentityUtil.getSecuredDocumentBuilderFactory();

        DocumentBuilder docBuilder = documentBuilderFactory.newDocumentBuilder();
        Document document = docBuilder.parse(new ByteArrayInputStream(xmlString.trim().getBytes()));
        Element element = document.getDocumentElement();
        UnmarshallerFactory unmarshallerFactory = Configuration.getUnmarshallerFactory();
        Unmarshaller unmarshaller = unmarshallerFactory.getUnmarshaller(element);
        return unmarshaller.unmarshall(element);
    } catch (Exception e) {
        log.error("Error in constructing XML(SAML or XACML) Object from the encoded String", e);
        throw new EntitlementException("Error in constructing XML(SAML or XACML) from the encoded String ", e);
    }
}
 
开发者ID:wso2,项目名称:carbon-identity-framework,代码行数:25,代码来源:WSXACMLMessageReceiver.java

示例3: unmarshall

import org.opensaml.Configuration; //导入方法依赖的package包/类
/**
 * Constructing the SAML or XACML Objects from a String
 *
 * @param xmlString Decoded SAML or XACML String
 * @return SAML or XACML Object
 * @throws org.wso2.carbon.identity.entitlement.EntitlementException
 */
public XMLObject unmarshall(String xmlString) throws EntitlementException {

    try {
        doBootstrap();
        DocumentBuilderFactory documentBuilderFactory = DocumentBuilderFactory.newInstance();
        documentBuilderFactory.setNamespaceAware(true);

        documentBuilderFactory.setExpandEntityReferences(false);
        documentBuilderFactory.setFeature(XMLConstants.FEATURE_SECURE_PROCESSING, true);
        SecurityManager securityManager = new SecurityManager();
        securityManager.setEntityExpansionLimit(ENTITY_EXPANSION_LIMIT);
        documentBuilderFactory.setAttribute(SECURITY_MANAGER_PROPERTY, securityManager);

        DocumentBuilder docBuilder = documentBuilderFactory.newDocumentBuilder();
        docBuilder.setEntityResolver(new CarbonEntityResolver());
        Document document = docBuilder.parse(new ByteArrayInputStream(xmlString.trim().getBytes()));
        Element element = document.getDocumentElement();
        UnmarshallerFactory unmarshallerFactory = Configuration.getUnmarshallerFactory();
        Unmarshaller unmarshaller = unmarshallerFactory.getUnmarshaller(element);
        return unmarshaller.unmarshall(element);
    } catch (Exception e) {
        log.error("Error in constructing XML(SAML or XACML) Object from the encoded String", e);
        throw new EntitlementException("Error in constructing XML(SAML or XACML) from the encoded String ", e);
    }
}
 
开发者ID:wso2-attic,项目名称:carbon-identity,代码行数:33,代码来源:WSXACMLMessageReceiver.java

示例4: unmarshall

import org.opensaml.Configuration; //导入方法依赖的package包/类
/**
 * Constructing the SAML or XACML Objects from a String
 *
 * @param xmlString Decoded SAML or XACML String
 * @return SAML or XACML Object
 * @throws org.wso2.carbon.identity.base.IdentityException
 */
public static XMLObject unmarshall(String xmlString) throws IdentityException {

    try {
        DocumentBuilderFactory documentBuilderFactory = DocumentBuilderFactory.newInstance();
        documentBuilderFactory.setNamespaceAware(true);

        documentBuilderFactory.setExpandEntityReferences(false);
        documentBuilderFactory.setFeature(XMLConstants.FEATURE_SECURE_PROCESSING, true);
        org.apache.xerces.util.SecurityManager securityManager = new SecurityManager();
        securityManager.setEntityExpansionLimit(ENTITY_EXPANSION_LIMIT);
        documentBuilderFactory.setAttribute(SECURITY_MANAGER_PROPERTY, securityManager);

        DocumentBuilder docBuilder = documentBuilderFactory.newDocumentBuilder();
        docBuilder.setEntityResolver(new CarbonEntityResolver());
        Document document = docBuilder.parse(new ByteArrayInputStream(xmlString.trim().getBytes(Charsets.UTF_8)));
        Element element = document.getDocumentElement();
        UnmarshallerFactory unmarshallerFactory = Configuration.getUnmarshallerFactory();
        Unmarshaller unmarshaller = unmarshallerFactory.getUnmarshaller(element);
        return unmarshaller.unmarshall(element);
    } catch (ParserConfigurationException | UnmarshallingException | SAXException | IOException e) {
        String message = "Error in constructing XML Object from the encoded String";
        throw IdentityException.error(message, e);
    }
}
 
开发者ID:wso2-attic,项目名称:carbon-identity,代码行数:32,代码来源:IdentityUtil.java

示例5: setUp

import org.opensaml.Configuration; //导入方法依赖的package包/类
/** {@inheritDoc} */
protected void setUp(){
    OrganizationBuilder orgBuilder = (OrganizationBuilder) Configuration.getBuilderFactory().getBuilder(Organization.TYPE_NAME);
    organization = orgBuilder.buildObject();            

    OrganizationNameBuilder orgNameBuilder = (OrganizationNameBuilder) Configuration.getBuilderFactory().getBuilder(OrganizationName.DEFAULT_ELEMENT_NAME);     
    OrganizationName newOrgName = orgNameBuilder.buildObject();
    newOrgName.setName(new LocalizedString("OrgFullName", "en"));
    organization.getOrganizationNames().add(newOrgName);

    OrganizationDisplayNameBuilder orgDisplayNameBuilder = (OrganizationDisplayNameBuilder) Configuration.getBuilderFactory().getBuilder(OrganizationDisplayName.DEFAULT_ELEMENT_NAME); 
    OrganizationDisplayName newOrgDisplayName = orgDisplayNameBuilder.buildObject();
    newOrgDisplayName.setName(new LocalizedString("OrgDisplayName", "en"));
    organization.getDisplayNames().add(newOrgDisplayName);

    OrganizationURLBuilder orgURLBuilder = (OrganizationURLBuilder) Configuration.getBuilderFactory().getBuilder(OrganizationURL.DEFAULT_ELEMENT_NAME);     
    OrganizationURL newOrgURL = orgURLBuilder.buildObject();    
    newOrgURL.setURL(new LocalizedString("http://org.url.edu", "en"));
    organization.getURLs().add(newOrgURL);
    
    MarshallerFactory marshallerFactory = Configuration.getMarshallerFactory();
    orgMarshaller = marshallerFactory.getMarshaller(organization);
    
    UnmarshallerFactory unmarshallerFactory = Configuration.getUnmarshallerFactory();
    orgUnmarshaller = unmarshallerFactory.getUnmarshaller(organization.getElementQName());
}
 
开发者ID:apigee,项目名称:java-opensaml2,代码行数:27,代码来源:RoundTripTest.java

示例6: unmarshall

import org.opensaml.Configuration; //导入方法依赖的package包/类
/**
 * Constructing the XMLObject Object from a String
 *
 * @param authReqStr
 * @return Corresponding XMLObject which is a SAML2 object
 * @throws Exception
 */
public static XMLObject unmarshall(String authReqStr) throws Exception {
    try {
        doBootstrap();
        DocumentBuilderFactory documentBuilderFactory = DocumentBuilderFactory.newInstance();
        documentBuilderFactory.setNamespaceAware(true);
        DocumentBuilder docBuilder = documentBuilderFactory.newDocumentBuilder();
        Document document = docBuilder.parse(new ByteArrayInputStream(authReqStr.trim().getBytes()));
        Element element = document.getDocumentElement();
        UnmarshallerFactory unmarshallerFactory = Configuration.getUnmarshallerFactory();
        Unmarshaller unmarshaller = unmarshallerFactory.getUnmarshaller(element);
        return unmarshaller.unmarshall(element);
    } catch (Exception e) {
        throw new Exception("Error in constructing AuthRequest from " +
                            "the encoded String ", e);
    }
}
 
开发者ID:wso2,项目名称:carbon-commons,代码行数:24,代码来源:Util.java

示例7: setUp

import org.opensaml.Configuration; //导入方法依赖的package包/类
@Before
public void setUp() throws Exception {
	DocumentBuilderFactory documentBuilderFactory = DocumentBuilderFactory.newInstance();
	documentBuilderFactory.setNamespaceAware(true);
	Document doc = documentBuilderFactory.newDocumentBuilder().parse(OIORequest.class.getResourceAsStream("request.xml"));
	Configuration.getBuilderFactory();
	UnmarshallerFactory unmarshallerFactory = Configuration.getUnmarshallerFactory();
	Unmarshaller unmarshaller = unmarshallerFactory.getUnmarshaller(doc.getDocumentElement());
	request = (RequestAbstractType) unmarshaller.unmarshall(doc.getDocumentElement());
	request.getIssuer().setValue("IssuerValue");
}
 
开发者ID:amagdenko,项目名称:oiosaml.java,代码行数:12,代码来源:UtilsTest.java

示例8: unmarshall

import org.opensaml.Configuration; //导入方法依赖的package包/类
/**
 * Constructing the XMLObject Object from a String
 *
 * @param authReqStr
 * @return Corresponding XMLObject which is a SAML2 object
 * @throws SAML2SSOUIAuthenticatorException
 */
public static XMLObject unmarshall(String authReqStr) throws SAML2SSOUIAuthenticatorException {

    try {
        doBootstrap();
        DocumentBuilderFactory documentBuilderFactory = DocumentBuilderFactory.newInstance();
        documentBuilderFactory.setNamespaceAware(true);

        documentBuilderFactory.setExpandEntityReferences(false);
        documentBuilderFactory.setFeature(XMLConstants.FEATURE_SECURE_PROCESSING, true);
        SecurityManager securityManager = new SecurityManager();
        securityManager.setEntityExpansionLimit(ENTITY_EXPANSION_LIMIT);
        documentBuilderFactory.setAttribute(SECURITY_MANAGER_PROPERTY, securityManager);

        DocumentBuilder docBuilder = documentBuilderFactory.newDocumentBuilder();
        docBuilder.setEntityResolver(new CarbonEntityResolver());
        Document document = docBuilder.parse(new ByteArrayInputStream(authReqStr.trim()
                .getBytes()));
        Element element = document.getDocumentElement();
        UnmarshallerFactory unmarshallerFactory = Configuration.getUnmarshallerFactory();
        Unmarshaller unmarshaller = unmarshallerFactory.getUnmarshaller(element);
        return unmarshaller.unmarshall(element);
    } catch (Exception e) {
        log.error("Error in constructing AuthRequest from the encoded String", e);
        throw new SAML2SSOUIAuthenticatorException("Error in constructing AuthRequest from "
                + "the encoded String ", e);
    }
}
 
开发者ID:wso2-attic,项目名称:carbon-identity,代码行数:35,代码来源:Util.java

示例9: unmarshall

import org.opensaml.Configuration; //导入方法依赖的package包/类
/**
 * Constructing the SAML or XACML Objects from a String
 *
 * @param xmlString Decoded SAML or XACML String
 * @return SAML or XACML Object
 * @throws EntitlementProxyException
 */
private XMLObject unmarshall(String xmlString) throws EntitlementProxyException {

    try {
        doBootstrap();
        DocumentBuilderFactory documentBuilderFactory = DocumentBuilderFactory.newInstance();
        documentBuilderFactory.setNamespaceAware(true);

        documentBuilderFactory.setExpandEntityReferences(false);
        documentBuilderFactory.setFeature(XMLConstants.FEATURE_SECURE_PROCESSING, true);
        SecurityManager securityManager = new SecurityManager();
        securityManager.setEntityExpansionLimit(ENTITY_EXPANSION_LIMIT);
        documentBuilderFactory.setAttribute(SECURITY_MANAGER_PROPERTY, securityManager);

        DocumentBuilder docBuilder = documentBuilderFactory.newDocumentBuilder();
        docBuilder.setEntityResolver(new CarbonEntityResolver());
        Document document = docBuilder.parse(new ByteArrayInputStream(xmlString.trim().getBytes(Charset.forName
                ("UTF-8"))));
        Element element = document.getDocumentElement();
        UnmarshallerFactory unmarshallerFactory = Configuration.getUnmarshallerFactory();
        Unmarshaller unmarshaller = unmarshallerFactory.getUnmarshaller(element);
        return unmarshaller.unmarshall(element);
    } catch (Exception e) {
        log.error("Error in constructing XML(SAML or XACML) Object from the encoded String", e);
        throw new EntitlementProxyException(
                "Error in constructing XML(SAML or XACML) from the encoded String", e);
    }
}
 
开发者ID:wso2-attic,项目名称:carbon-identity,代码行数:35,代码来源:WSXACMLEntitlementServiceClient.java

示例10: BaseTestCase

import org.opensaml.Configuration; //导入方法依赖的package包/类
/** Constructor. */
public BaseTestCase(){
    super();
    
    parser = new BasicParserPool();
    parser.setNamespaceAware(true);
    builderFactory = Configuration.getBuilderFactory();
    marshallerFactory = Configuration.getMarshallerFactory();
    unmarshallerFactory = Configuration.getUnmarshallerFactory();
}
 
开发者ID:apigee,项目名称:java-opensaml2,代码行数:11,代码来源:BaseTestCase.java

示例11: decodeSAMLResponse

import org.opensaml.Configuration; //导入方法依赖的package包/类
public static Response decodeSAMLResponse(String responseMessage)
        throws ConfigurationException, ParserConfigurationException,
        SAXException, IOException, UnmarshallingException {
    DocumentBuilderFactory documentBuilderFactory = DocumentBuilderFactory.newInstance();
    documentBuilderFactory.setNamespaceAware(true);
    DocumentBuilder docBuilder = documentBuilderFactory.newDocumentBuilder();
    byte[] base64DecodedResponse = Base64.decode(responseMessage);
    Document document = docBuilder.parse(new ByteArrayInputStream(base64DecodedResponse));
    Element element = document.getDocumentElement();
    UnmarshallerFactory unmarshallerFactory = Configuration.getUnmarshallerFactory();
    Unmarshaller unmarshaller = unmarshallerFactory.getUnmarshaller(element);
    return (Response) unmarshaller.unmarshall(element);
}
 
开发者ID:apache,项目名称:cloudstack,代码行数:14,代码来源:SAMLUtils.java

示例12: unmarshallArtifactResolve

import org.opensaml.Configuration; //导入方法依赖的package包/类
public static ArtifactResolve unmarshallArtifactResolve(final InputStream input) throws IllegalAccessException, UnmarshallingException, XMLParserException {
	BasicParserPool ppMgr = new BasicParserPool();
	ppMgr.setNamespaceAware(true);

	Document soap = ppMgr.parse(input);
	Element soapRoot = soap.getDocumentElement();

	// Get apropriate unmarshaller
	UnmarshallerFactory unmarshallerFactory = Configuration.getUnmarshallerFactory();
	Unmarshaller unmarshaller = unmarshallerFactory.getUnmarshaller(soapRoot);

	Envelope soapEnvelope = (Envelope)unmarshaller.unmarshall(soapRoot);
	return (ArtifactResolve)soapEnvelope.getBody().getUnknownXMLObjects().get(0);
}
 
开发者ID:rasmusson,项目名称:MockIDP,代码行数:15,代码来源:MockIDPArtifactResolve.java


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