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


Java Configuration.getUnmarshallerFactory方法代码示例

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


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

示例1: Decrypter

import org.opensaml.xml.Configuration; //导入方法依赖的package包/类
/**
 * Constructor.
 * 
 * @param newResolver resolver for data encryption keys.
 * @param newKEKResolver resolver for key encryption keys.
 * @param newEncKeyResolver resolver for EncryptedKey elements
 */
public Decrypter(KeyInfoCredentialResolver newResolver, KeyInfoCredentialResolver newKEKResolver,
        EncryptedKeyResolver newEncKeyResolver) {
    resolver = newResolver;
    kekResolver = newKEKResolver;
    encKeyResolver = newEncKeyResolver;

    resolverCriteria = null;
    kekResolverCriteria = null;

    // Note: this is hopefully only temporary, until Xerces implements DOM 3 LSParser.parseWithContext().
    parserPool = new BasicParserPool();
    parserPool.setNamespaceAware(true);

    // Note: this is necessary due to an unresolved Xerces deferred DOM issue/bug
    HashMap<String, Boolean> features = new HashMap<String, Boolean>();
    features.put("http://apache.org/xml/features/dom/defer-node-expansion", Boolean.FALSE);
    parserPool.setBuilderFeatures(features);

    unmarshallerFactory = Configuration.getUnmarshallerFactory();
    
    defaultRootInNewDocument = false;
}
 
开发者ID:lamsfoundation,项目名称:lams,代码行数:30,代码来源:Decrypter.java

示例2: Encrypter

import org.opensaml.xml.Configuration; //导入方法依赖的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: buildOpenSamlXmlObjectFromResource

import org.opensaml.xml.Configuration; //导入方法依赖的package包/类
/**
 * Read a Ressource File.
 * 
 * @param resourceFile
 * @return the string representation of the file
 * @throws IOException
 * @throws SecurityException
 * @throws MessageDecodingException
 */
public static XMLObject buildOpenSamlXmlObjectFromResource(final Resource resourceFile)
		throws Exception {
	// Parse XML file
	BasicParserPool ppMgr = new BasicParserPool();
	ppMgr.setNamespaceAware(true);
	Document inCommonMDDoc = ppMgr.parse(resourceFile.getInputStream());
	Element rootElement = inCommonMDDoc.getDocumentElement();

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

	// Unmarshall using the document root element, an EntitiesDescriptor in this case
	XMLObject xmlObject = unmarshaller.unmarshall(rootElement);

	Assert.assertNotNull("Unable to read test SAML XML file !", xmlObject);

	return xmlObject;
}
 
开发者ID:mxbossard,项目名称:java-saml2-sp,代码行数:29,代码来源:SamlTestResourcesHelper.java

示例4: parseSamlObject

import org.opensaml.xml.Configuration; //导入方法依赖的package包/类
public static XMLObject parseSamlObject(String xmlInput)
		throws XMLParserException, UnmarshallingException {
	LOGGER.entering(SamlTool.class.getName(), "parseSamlObject", xmlInput);

	StringReader reader = new StringReader(xmlInput);

	// Parse metadata file
	Document inCommonMDDoc = basicParserPool.parse(reader);
	Element metadataRoot = inCommonMDDoc.getDocumentElement();

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

	// Unmarshall using the document root element, an EntitiesDescriptor in
	// this case
	XMLObject result = unmarshaller.unmarshall(metadataRoot);
	LOGGER.exiting(SamlTool.class.getName(), "parseSamlObject", result);
	return result;
}
 
开发者ID:vetsin,项目名称:SamlSnort,代码行数:23,代码来源:SamlTool.java

示例5: parseTokenFromString

import org.opensaml.xml.Configuration; //导入方法依赖的package包/类
/**
 * parseTokenFromString converts a raw wresult and extracts it into an assertion.
 *
 * @param wresult the raw token returned by the IdP
 * @return an assertion
 */
public static Assertion parseTokenFromString(final String wresult) {
    try (final InputStream in = new ByteArrayInputStream(wresult.getBytes("UTF-8"))) {
        final BasicParserPool parserPool = new BasicParserPool();
        parserPool.setNamespaceAware(true);

        final Document document = parserPool.parse(in);
        final Element metadataRoot = document.getDocumentElement();
        final UnmarshallerFactory unmarshallerFactory = Configuration.getUnmarshallerFactory();
        final Unmarshaller unmarshaller = unmarshallerFactory.getUnmarshaller(metadataRoot);
        final RequestSecurityTokenResponseImpl rsToken = (RequestSecurityTokenResponseImpl) unmarshaller.unmarshall(metadataRoot);

        //Get our SAML token
        final List<RequestedSecurityToken> rst = rsToken.getRequestedSecurityToken();
        final AssertionImpl assertion = (AssertionImpl) rst.get(0).getSecurityTokens().get(0);

        if (assertion == null) {
            LOGGER.debug("parseTokenFromString: assertion null");
        } else {
            LOGGER.debug("parseTokenFromString: {}", assertion);
        }
        return assertion;
    } catch (final Exception ex) {
        LOGGER.warn(ex.getMessage());
        return null;
    }
}
 
开发者ID:Unicon,项目名称:cas-adfs-integration,代码行数:33,代码来源:WsFederationUtils.java

示例6: convertToSAMLResponse

import org.opensaml.xml.Configuration; //导入方法依赖的package包/类
/**
 * Convert w3c element to a SAML response
 * @param element
 * @return
 */
public org.opensaml.saml2.core.Response convertToSAMLResponse(org.w3c.dom.Element element) {
    org.opensaml.saml2.core.Response samlResponse = null;

    UnmarshallerFactory unmarshallerFactory = Configuration.getUnmarshallerFactory();
    Unmarshaller unmarshaller = unmarshallerFactory.getUnmarshaller(element);

    if(unmarshaller == null) {
        raiseSamlValidationError("Invalid SAML Response", null);
    }

    XMLObject responseXmlObj = null;

    try {
        responseXmlObj = unmarshaller.unmarshall(element);
    } catch (UnmarshallingException e) {
        raiseSamlValidationError("Error unmarshalling response from IdP", null);
    }

    if (responseXmlObj instanceof org.opensaml.saml2.core.Response) {
        samlResponse = (org.opensaml.saml2.core.Response) responseXmlObj;
    } else {
        raiseSamlValidationError("Response is in an improper format", null);
    }

    return samlResponse;
}
 
开发者ID:inbloom,项目名称:secure-data-service,代码行数:32,代码来源:SamlHelper.java

示例7: AbstractXMLObjectUnmarshaller

import org.opensaml.xml.Configuration; //导入方法依赖的package包/类
/**
 * Constructor.
 */
protected AbstractXMLObjectUnmarshaller() {
    xmlObjectBuilderFactory = Configuration.getBuilderFactory();
    unmarshallerFactory = Configuration.getUnmarshallerFactory();
}
 
开发者ID:lamsfoundation,项目名称:lams,代码行数:8,代码来源:AbstractXMLObjectUnmarshaller.java

示例8: BaseMetadataProvider

import org.opensaml.xml.Configuration; //导入方法依赖的package包/类
/** Constructor. */
public BaseMetadataProvider() {
    requireValidMetadata = false;
    unmarshallerFactory = Configuration.getUnmarshallerFactory();
}
 
开发者ID:lamsfoundation,项目名称:lams,代码行数:6,代码来源:BaseMetadataProvider.java


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