Search in sources :

Example 11 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 12 with MarshallingException

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

the class IdpMetadataPublicKeyStoreTest method idpEntityDescriptor.

private static EntityDescriptor idpEntityDescriptor(String idpEntityId, String public_signing_certificate) {
    KeyDescriptor keyDescriptor = buildKeyDescriptor(public_signing_certificate);
    IDPSSODescriptor idpssoDescriptor = IdpSsoDescriptorBuilder.anIdpSsoDescriptor().addKeyDescriptor(keyDescriptor).withoutDefaultSigningKey().build();
    try {
        return EntityDescriptorBuilder.anEntityDescriptor().withEntityId(idpEntityId).withIdpSsoDescriptor(idpssoDescriptor).withValidUntil(DateTime.now().plusWeeks(2)).withSignature(null).withoutSigning().setAddDefaultSpServiceDescriptor(false).build();
    } catch (MarshallingException | SignatureException e) {
        throw new RuntimeException(e);
    }
}
Also used : IDPSSODescriptor(org.opensaml.saml.saml2.metadata.IDPSSODescriptor) MarshallingException(org.opensaml.core.xml.io.MarshallingException) KeyDescriptor(org.opensaml.saml.saml2.metadata.KeyDescriptor) SignatureException(org.opensaml.xmlsec.signature.support.SignatureException)

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