Search in sources :

Example 1 with XmlObjectToElementTransformer

use of uk.gov.ida.saml.serializers.XmlObjectToElementTransformer in project verify-hub by alphagov.

the class EntitiesDescriptorToElementTransformerTest method transform_shouldTransformASamlObjectIntoAnElement.

@Test
public void transform_shouldTransformASamlObjectIntoAnElement() {
    AuthnRequest authnRequest = anAuthnRequest().withIssuer(anIssuer().build()).build();
    XmlObjectToElementTransformer<AuthnRequest> transformer = new XmlObjectToElementTransformer<>();
    Element result = transformer.apply(authnRequest);
    assertThat(result).isNotNull();
}
Also used : AuthnRequestBuilder.anAuthnRequest(uk.gov.ida.saml.core.test.builders.AuthnRequestBuilder.anAuthnRequest) AuthnRequest(org.opensaml.saml.saml2.core.AuthnRequest) XmlObjectToElementTransformer(uk.gov.ida.saml.serializers.XmlObjectToElementTransformer) Element(org.w3c.dom.Element) Test(org.junit.jupiter.api.Test)

Example 2 with XmlObjectToElementTransformer

use of uk.gov.ida.saml.serializers.XmlObjectToElementTransformer in project verify-hub by alphagov.

the class MatchingServiceRequestSenderTest method createMsaResponse.

private static String createMsaResponse() throws MarshallingException, SignatureException {
    Credential signingCredential = msaSigningCredential;
    org.opensaml.saml.saml2.core.Response response = aResponse().withIssuer(IssuerBuilder.anIssuer().withIssuerId(TEST_RP_MS).build()).withSigningCredential(signingCredential).build();
    Document soapEnvelope = new SoapMessageManager().wrapWithSoapEnvelope(new XmlObjectToElementTransformer<>().apply(response));
    return XmlUtils.writeToString(soapEnvelope);
}
Also used : Credential(org.opensaml.security.credential.Credential) XmlObjectToElementTransformer(uk.gov.ida.saml.serializers.XmlObjectToElementTransformer) Document(org.w3c.dom.Document) SoapMessageManager(uk.gov.ida.hub.samlsoapproxy.soap.SoapMessageManager)

Aggregations

XmlObjectToElementTransformer (uk.gov.ida.saml.serializers.XmlObjectToElementTransformer)2 Test (org.junit.jupiter.api.Test)1 AuthnRequest (org.opensaml.saml.saml2.core.AuthnRequest)1 Credential (org.opensaml.security.credential.Credential)1 Document (org.w3c.dom.Document)1 Element (org.w3c.dom.Element)1 SoapMessageManager (uk.gov.ida.hub.samlsoapproxy.soap.SoapMessageManager)1 AuthnRequestBuilder.anAuthnRequest (uk.gov.ida.saml.core.test.builders.AuthnRequestBuilder.anAuthnRequest)1