Search in sources :

Example 1 with Header

use of org.opensaml.soap.soap11.Header in project cas by apereo.

the class SamlProfileSamlSoap11FaultResponseBuilder method build.

@Override
public Envelope build(final AuthnRequest authnRequest, final HttpServletRequest request, final HttpServletResponse response, final org.jasig.cas.client.validation.Assertion casAssertion, final SamlRegisteredService service, final SamlRegisteredServiceServiceProviderMetadataFacade adaptor) throws SamlException {
    final Header header = newSoapObject(Header.class);
    final Body body = newSoapObject(Body.class);
    final Fault fault = newSoapObject(Fault.class);
    final FaultCode faultCode = newSoapObject(FaultCode.class);
    faultCode.setValue(FaultCode.SERVER);
    fault.setCode(faultCode);
    final FaultActor faultActor = newSoapObject(FaultActor.class);
    faultActor.setValue(SamlIdPUtils.getIssuerFromSamlRequest(authnRequest));
    fault.setActor(faultActor);
    final FaultString faultString = newSoapObject(FaultString.class);
    faultString.setValue(request.getAttribute(SamlIdPConstants.REQUEST_ATTRIBUTE_ERROR).toString());
    fault.setMessage(faultString);
    body.getUnknownXMLObjects().add(fault);
    final Envelope envelope = newSoapObject(Envelope.class);
    envelope.setHeader(header);
    envelope.setBody(body);
    encodeFinalResponse(request, response, service, adaptor, envelope);
    return envelope;
}
Also used : FaultCode(org.opensaml.soap.soap11.FaultCode) FaultActor(org.opensaml.soap.soap11.FaultActor) Header(org.opensaml.soap.soap11.Header) Fault(org.opensaml.soap.soap11.Fault) FaultString(org.opensaml.soap.soap11.FaultString) Envelope(org.opensaml.soap.soap11.Envelope) Body(org.opensaml.soap.soap11.Body)

Example 2 with Header

use of org.opensaml.soap.soap11.Header in project okhttp by square.

the class HeadersTest method readNameValueBlockDropsForbiddenHeadersHttp2.

@Test
public void readNameValueBlockDropsForbiddenHeadersHttp2() throws IOException {
    List<Header> headerBlock = headerEntries(":status", "200 OK", ":version", "HTTP/1.1", "connection", "close");
    Request request = new Request.Builder().url("http://square.com/").build();
    Response response = Http2Codec.readHttp2HeadersList(headerBlock).request(request).build();
    Headers headers = response.headers();
    assertEquals(1, headers.size());
    assertEquals(":version", headers.name(0));
    assertEquals("HTTP/1.1", headers.value(0));
}
Also used : Header(okhttp3.internal.http2.Header) HttpHeaders(okhttp3.internal.http.HttpHeaders) Test(org.junit.Test)

Example 3 with Header

use of org.opensaml.soap.soap11.Header in project ddf by codice.

the class SamlProtocol method createSoapMessage.

public static Envelope createSoapMessage(SignableSAMLObject signableSAMLObject) {
    Body body = soapBodyBuilder.buildObject();
    body.getUnknownXMLObjects().add(signableSAMLObject);
    Envelope envelope = soapEnvelopeBuilder.buildObject();
    envelope.setBody(body);
    Header header = soapHeaderBuilder.buildObject();
    envelope.setHeader(header);
    return envelope;
}
Also used : Header(org.opensaml.soap.soap11.Header) Envelope(org.opensaml.soap.soap11.Envelope) Body(org.opensaml.soap.soap11.Body)

Example 4 with Header

use of org.opensaml.soap.soap11.Header in project cas by apereo.

the class SamlProfileSamlSoap11FaultResponseBuilder method build.

@Override
public Envelope build(final RequestAbstractType authnRequest, final HttpServletRequest request, final HttpServletResponse response, final Object casAssertion, final SamlRegisteredService service, final SamlRegisteredServiceServiceProviderMetadataFacade adaptor, final String binding) throws SamlException {
    final Header header = newSoapObject(Header.class);
    final Body body = newSoapObject(Body.class);
    final Fault fault = newSoapObject(Fault.class);
    final FaultCode faultCode = newSoapObject(FaultCode.class);
    faultCode.setValue(FaultCode.SERVER);
    fault.setCode(faultCode);
    final FaultActor faultActor = newSoapObject(FaultActor.class);
    faultActor.setValue(SamlIdPUtils.getIssuerFromSamlRequest(authnRequest));
    fault.setActor(faultActor);
    final FaultString faultString = newSoapObject(FaultString.class);
    faultString.setValue(request.getAttribute(SamlIdPConstants.REQUEST_ATTRIBUTE_ERROR).toString());
    fault.setMessage(faultString);
    body.getUnknownXMLObjects().add(fault);
    final Envelope envelope = newSoapObject(Envelope.class);
    envelope.setHeader(header);
    envelope.setBody(body);
    encodeFinalResponse(request, response, service, adaptor, envelope, binding, authnRequest, casAssertion);
    return envelope;
}
Also used : FaultCode(org.opensaml.soap.soap11.FaultCode) FaultActor(org.opensaml.soap.soap11.FaultActor) Header(org.opensaml.soap.soap11.Header) Fault(org.opensaml.soap.soap11.Fault) FaultString(org.opensaml.soap.soap11.FaultString) Envelope(org.opensaml.soap.soap11.Envelope) Body(org.opensaml.soap.soap11.Body)

Example 5 with Header

use of org.opensaml.soap.soap11.Header in project okhttp by square.

the class Case method getHeaders.

public List<Header> getHeaders() {
    List<Header> result = new ArrayList<>();
    for (Map<String, String> inputHeader : headers) {
        Map.Entry<String, String> entry = inputHeader.entrySet().iterator().next();
        result.add(new Header(entry.getKey(), entry.getValue()));
    }
    return result;
}
Also used : Header(okhttp3.internal.http2.Header) ArrayList(java.util.ArrayList) ByteString(okio.ByteString) LinkedHashMap(java.util.LinkedHashMap) Map(java.util.Map)

Aggregations

Body (org.opensaml.soap.soap11.Body)11 Envelope (org.opensaml.soap.soap11.Envelope)11 Header (org.opensaml.soap.soap11.Header)11 lombok.val (lombok.val)4 HttpServletResponse (javax.servlet.http.HttpServletResponse)3 SOAPObjectBuilder (org.opensaml.soap.common.SOAPObjectBuilder)3 FaultString (org.opensaml.soap.soap11.FaultString)3 Header (okhttp3.internal.http2.Header)2 Order (org.junit.jupiter.api.Order)2 Test (org.junit.jupiter.api.Test)2 TestMethodOrder (org.junit.jupiter.api.TestMethodOrder)2 Response (org.opensaml.saml.saml2.ecp.Response)2 Fault (org.opensaml.soap.soap11.Fault)2 FaultActor (org.opensaml.soap.soap11.FaultActor)2 FaultCode (org.opensaml.soap.soap11.FaultCode)2 MockHttpServletRequest (org.springframework.mock.web.MockHttpServletRequest)2 MockHttpServletResponse (org.springframework.mock.web.MockHttpServletResponse)2 ArrayList (java.util.ArrayList)1 LinkedHashMap (java.util.LinkedHashMap)1 Map (java.util.Map)1