Search in sources :

Example 6 with MarshallingException

use of org.opensaml.core.xml.io.MarshallingException in project spring-security by spring-projects.

the class OpenSamlSigningUtils method serialize.

static String serialize(XMLObject object) {
    try {
        Marshaller marshaller = XMLObjectProviderRegistrySupport.getMarshallerFactory().getMarshaller(object);
        Element element = marshaller.marshall(object);
        return SerializeSupport.nodeToString(element);
    } catch (MarshallingException ex) {
        throw new Saml2Exception(ex);
    }
}
Also used : Marshaller(org.opensaml.core.xml.io.Marshaller) MarshallingException(org.opensaml.core.xml.io.MarshallingException) Element(org.w3c.dom.Element) Saml2Exception(org.springframework.security.saml2.Saml2Exception)

Example 7 with MarshallingException

use of org.opensaml.core.xml.io.MarshallingException in project ddf by codice.

the class AttributeQueryClient method createSoapMessage.

/**
 * Creates a SOAP message of the AttributeQuery request.
 *
 * @param attributeQuery is added to the SOAP message
 * @return soapElement is the Element of the SOAP message
 */
private Element createSoapMessage(AttributeQuery attributeQuery) throws AttributeQueryException {
    LOGGER.debug("Creating SOAP message from the SAML AttributeQuery.");
    Envelope envelope = SamlProtocol.createSoapMessage(attributeQuery);
    LOGGER.debug("SOAP message from the SAML AttributeQuery created.");
    try {
        return new EnvelopeMarshaller().marshall(envelope);
    } catch (MarshallingException e) {
        throw new AttributeQueryException("Cannot marshall SOAP object to an Element.", e);
    }
}
Also used : EnvelopeMarshaller(org.opensaml.soap.soap11.impl.EnvelopeMarshaller) MarshallingException(org.opensaml.core.xml.io.MarshallingException) Envelope(org.opensaml.soap.soap11.Envelope)

Example 8 with MarshallingException

use of org.opensaml.core.xml.io.MarshallingException in project verify-hub by alphagov.

the class NodeMetadataFactory method createCountryEntityDescriptor.

public static EntityDescriptor createCountryEntityDescriptor(String entityID) {
    Signature entityDescriptorSignature = createSignature();
    KeyDescriptor keyDescriptor = KeyDescriptorBuilder.aKeyDescriptor().withX509ForSigning(TEST_PUBLIC_CERT).build();
    IDPSSODescriptor idpssoDescriptor = IdpSsoDescriptorBuilder.anIdpSsoDescriptor().addKeyDescriptor(keyDescriptor).build();
    try {
        return getEntityDescriptor(entityID, idpssoDescriptor, entityDescriptorSignature);
    } catch (MarshallingException | SignatureException e) {
        throw Throwables.propagate(e);
    }
}
Also used : IDPSSODescriptor(org.opensaml.saml.saml2.metadata.IDPSSODescriptor) MarshallingException(org.opensaml.core.xml.io.MarshallingException) KeyDescriptor(org.opensaml.saml.saml2.metadata.KeyDescriptor) Signature(org.opensaml.xmlsec.signature.Signature) SignatureException(org.opensaml.xmlsec.signature.support.SignatureException)

Example 9 with MarshallingException

use of org.opensaml.core.xml.io.MarshallingException in project verify-hub by alphagov.

the class NodeMetadataFactory method createCountryEntityDescriptor.

public static EntityDescriptor createCountryEntityDescriptor(String entityID) {
    Signature entityDescriptorSignature = createSignature();
    KeyDescriptor keyDescriptor = KeyDescriptorBuilder.aKeyDescriptor().withX509ForSigning(TEST_PUBLIC_CERT).build();
    IDPSSODescriptor idpssoDescriptor = IdpSsoDescriptorBuilder.anIdpSsoDescriptor().addKeyDescriptor(keyDescriptor).build();
    try {
        return getEntityDescriptor(entityID, idpssoDescriptor, entityDescriptorSignature);
    } catch (MarshallingException | SignatureException e) {
        throw Throwables.propagate(e);
    }
}
Also used : IDPSSODescriptor(org.opensaml.saml.saml2.metadata.IDPSSODescriptor) MarshallingException(org.opensaml.core.xml.io.MarshallingException) KeyDescriptor(org.opensaml.saml.saml2.metadata.KeyDescriptor) Signature(org.opensaml.xmlsec.signature.Signature) SignatureException(org.opensaml.xmlsec.signature.support.SignatureException)

Example 10 with MarshallingException

use of org.opensaml.core.xml.io.MarshallingException in project spring-security by spring-projects.

the class OpenSamlSigningUtils method serialize.

static String serialize(XMLObject object) {
    try {
        Marshaller marshaller = XMLObjectProviderRegistrySupport.getMarshallerFactory().getMarshaller(object);
        Element element = marshaller.marshall(object);
        return SerializeSupport.nodeToString(element);
    } catch (MarshallingException ex) {
        throw new Saml2Exception(ex);
    }
}
Also used : Marshaller(org.opensaml.core.xml.io.Marshaller) MarshallingException(org.opensaml.core.xml.io.MarshallingException) Element(org.w3c.dom.Element) Saml2Exception(org.springframework.security.saml2.Saml2Exception)

Aggregations

MarshallingException (org.opensaml.core.xml.io.MarshallingException)12 Saml2Exception (org.springframework.security.saml2.Saml2Exception)7 Marshaller (org.opensaml.core.xml.io.Marshaller)6 Element (org.w3c.dom.Element)6 SignatureException (org.opensaml.xmlsec.signature.support.SignatureException)4 IDPSSODescriptor (org.opensaml.saml.saml2.metadata.IDPSSODescriptor)3 KeyDescriptor (org.opensaml.saml.saml2.metadata.KeyDescriptor)3 Signature (org.opensaml.xmlsec.signature.Signature)2 File (java.io.File)1 IOException (java.io.IOException)1 OutputStream (java.io.OutputStream)1 StringReader (java.io.StringReader)1 StringWriter (java.io.StringWriter)1 Transformer (javax.xml.transform.Transformer)1 StreamResult (javax.xml.transform.stream.StreamResult)1 StreamSource (javax.xml.transform.stream.StreamSource)1 ComponentInitializationException (net.shibboleth.utilities.java.support.component.ComponentInitializationException)1 ResolverException (net.shibboleth.utilities.java.support.resolver.ResolverException)1 MetadataResolver (org.opensaml.saml.metadata.resolver.MetadataResolver)1 SecurityException (org.opensaml.security.SecurityException)1