Java Code Examples for org.opensaml.xml.Configuration#getUnmarshallerFactory()

The following examples show how to use org.opensaml.xml.Configuration#getUnmarshallerFactory() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: Decrypter.java    From lams with GNU General Public License v2.0 6 votes vote down vote up
/**
 * 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;
}
 
Example 2
Source File: Encrypter.java    From lams with GNU General Public License v2.0 5 votes vote down vote up
/**
 * 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;
}
 
Example 3
Source File: SamlHelper.java    From secure-data-service with Apache License 2.0 5 votes vote down vote up
/**
 * 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;
}
 
Example 4
Source File: AbstractXMLObjectUnmarshaller.java    From lams with GNU General Public License v2.0 4 votes vote down vote up
/**
 * Constructor.
 */
protected AbstractXMLObjectUnmarshaller() {
    xmlObjectBuilderFactory = Configuration.getBuilderFactory();
    unmarshallerFactory = Configuration.getUnmarshallerFactory();
}
 
Example 5
Source File: BaseMetadataProvider.java    From lams with GNU General Public License v2.0 4 votes vote down vote up
/** Constructor. */
public BaseMetadataProvider() {
    requireValidMetadata = false;
    unmarshallerFactory = Configuration.getUnmarshallerFactory();
}
 
Example 6
Source File: AbstractXMLObjectUnmarshaller.java    From lams with GNU General Public License v2.0 3 votes vote down vote up
/**
 * This constructor supports checking a DOM Element to be unmarshalled, either element name or schema type, against
 * a given namespace/local name pair.
 * 
 * @deprecated no replacement
 * 
 * @param targetNamespaceURI the namespace URI of either the schema type QName or element QName of the elements this
 *            unmarshaller operates on
 * @param targetLocalName the local name of either the schema type QName or element QName of the elements this
 *            unmarshaller operates on
 */
protected AbstractXMLObjectUnmarshaller(String targetNamespaceURI, String targetLocalName) {
    targetQName = XMLHelper.constructQName(targetNamespaceURI, targetLocalName, null);

    xmlObjectBuilderFactory = Configuration.getBuilderFactory();
    unmarshallerFactory = Configuration.getUnmarshallerFactory();
}