Search in sources :

Example 11 with Envelope

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

the class SamlProfileAttributeQueryResponseBuilder 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 AttributeQuery query = (AttributeQuery) authnRequest;
    final Header header = newSoapObject(Header.class);
    final Body body = newSoapObject(Body.class);
    final Response saml2Response = buildSaml2Response(casAssertion, query, service, adaptor, request, SAMLConstants.SAML2_POST_BINDING_URI);
    body.getUnknownXMLObjects().add(saml2Response);
    final Envelope envelope = newSoapObject(Envelope.class);
    envelope.setHeader(header);
    envelope.setBody(body);
    SamlUtils.logSamlObject(this.configBean, envelope);
    return encodeFinalResponse(request, response, service, adaptor, envelope, binding, authnRequest, casAssertion);
}
Also used : HttpServletResponse(javax.servlet.http.HttpServletResponse) Response(org.opensaml.saml.saml2.core.Response) Header(org.opensaml.soap.soap11.Header) AttributeQuery(org.opensaml.saml.saml2.core.AttributeQuery) Envelope(org.opensaml.soap.soap11.Envelope) Body(org.opensaml.soap.soap11.Body)

Example 12 with Envelope

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

the class SamlProfileSamlSoap11ResponseBuilder method buildResponse.

@Override
protected Envelope buildResponse(final Assertion assertion, final Object casAssertion, final RequestAbstractType authnRequest, final SamlRegisteredService service, final SamlRegisteredServiceServiceProviderMetadataFacade adaptor, final HttpServletRequest request, final HttpServletResponse response, final String binding) throws SamlException {
    LOGGER.debug("Locating the assertion consumer service url for binding [{}]", binding);
    @NonNull final AssertionConsumerService acs = adaptor.getAssertionConsumerService(binding);
    LOGGER.debug("Located assertion consumer service url [{}]", acs);
    final Response ecpResponse = newEcpResponse(acs.getLocation());
    final Header header = newSoapObject(Header.class);
    header.getUnknownXMLObjects().add(ecpResponse);
    final Body body = newSoapObject(Body.class);
    final org.opensaml.saml.saml2.core.Response saml2Response = buildSaml2Response(casAssertion, authnRequest, service, adaptor, request, binding);
    body.getUnknownXMLObjects().add(saml2Response);
    final Envelope envelope = newSoapObject(Envelope.class);
    envelope.setHeader(header);
    envelope.setBody(body);
    SamlUtils.logSamlObject(this.configBean, envelope);
    return envelope;
}
Also used : HttpServletResponse(javax.servlet.http.HttpServletResponse) Response(org.opensaml.saml.saml2.ecp.Response) Header(org.opensaml.soap.soap11.Header) NonNull(lombok.NonNull) AssertionConsumerService(org.opensaml.saml.saml2.metadata.AssertionConsumerService) Envelope(org.opensaml.soap.soap11.Envelope) Body(org.opensaml.soap.soap11.Body)

Aggregations

Envelope (org.opensaml.soap.soap11.Envelope)11 Body (org.opensaml.soap.soap11.Body)8 Header (org.opensaml.soap.soap11.Header)7 HttpServletResponse (javax.servlet.http.HttpServletResponse)3 Fault (org.opensaml.soap.soap11.Fault)3 Authentication (org.apereo.cas.authentication.Authentication)2 AuthenticationException (org.apereo.cas.authentication.AuthenticationException)2 SamlRegisteredService (org.apereo.cas.support.saml.services.SamlRegisteredService)2 SamlRegisteredServiceServiceProviderMetadataFacade (org.apereo.cas.support.saml.services.idp.metadata.SamlRegisteredServiceServiceProviderMetadataFacade)2 MessageContext (org.opensaml.messaging.context.MessageContext)2 AuthnRequest (org.opensaml.saml.saml2.core.AuthnRequest)2 Response (org.opensaml.saml.saml2.core.Response)2 Response (org.opensaml.saml.saml2.ecp.Response)2 SOAP11Context (org.opensaml.soap.messaging.context.SOAP11Context)2 FaultActor (org.opensaml.soap.soap11.FaultActor)2 FaultCode (org.opensaml.soap.soap11.FaultCode)2 FaultString (org.opensaml.soap.soap11.FaultString)2 Objects (java.util.Objects)1 NonNull (lombok.NonNull)1 Service (org.apereo.cas.authentication.principal.Service)1