Giter Site home page Giter Site logo

Comments (2)

spring-projects-issues avatar spring-projects-issues commented on June 22, 2024

Girish Kolantra Ramadevan said:

In AbstractProfileBase.java, the sendMessage method is written as follows

protected void sendMessage(boolean sign, SignableSAMLObject message, Endpoint endpoint, HttpServletResponse response) throws SAMLException, MessageEncodingException {

    BasicSAMLMessageContext<SAMLObject, SignableSAMLObject, SAMLObject> samlContext = new BasicSAMLMessageContext<SAMLObject, SignableSAMLObject, SAMLObject>();
    samlContext.setOutboundMessageTransport(new HttpServletResponseAdapter(response, false));
    samlContext.setOutboundSAMLMessage(message);
    samlContext.setPeerEntityEndpoint(endpoint);

    if (sign) {
        samlContext.setOutboundSAMLMessageSigningCredential(getSPSigningCredential());
    }

    MessageEncoder encoder = getEncoder(endpoint.getBinding());
    encoder.encode(samlContext);

}

In org.opensaml.saml2.binding.encoding.BaseSAML2MessageEncoder the getEndpointURL is written as

protected String getEndpointURL(SAMLMessageContext messageContext) throws MessageEncodingException {
Endpoint endpoint = messageContext.getPeerEntityEndpoint();
if (endpoint == null) {
throw new MessageEncodingException("Endpoint for relying party was null.");
}

    if (messageContext.getOutboundMessage() instanceof StatusResponseType
            && !DatatypeHelper.isEmpty(endpoint.getResponseLocation())) {
        return endpoint.getResponseLocation();
    } else {
        if (DatatypeHelper.isEmpty(endpoint.getLocation())) {
            throw new MessageEncodingException("Relying party endpoint location was null or empty.");
        }
        return endpoint.getLocation();
    }
}

If you notice, AbstractProfileBase.sendMessage(..) above calls samlContext.setOutboundSAMLMessage(message); so the line messageContext.getOutboundMessage() in BaseSAML2MessageEncoder.getEndpointURL(..) would return null. So even for response messages (like saml logout response) the endpoint.getLocation() would be used as destination and not endpoint.getResponseLocation() (this is the one to be used for response messages).

should we not add a line
samlContext.setOutboundMessage(message);

in AbstractProfileBase.sendMessage(..) above ?

from spring-security-saml.

spring-projects-issues avatar spring-projects-issues commented on June 22, 2024

Vladimir Schäfer said:

Yes Girish, you're right, the outboundMessage should be set in order to be correctly processed inside OpenSAML.
The call was added in revision 79.

from spring-security-saml.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.