Class AddressingResponseEndpointPolicy

java.lang.Object
org.apache.axis2.addressing.AddressingResponseEndpointPolicy

public final class AddressingResponseEndpointPolicy extends Object
Decides whether a wsa:ReplyTo or wsa:FaultTo endpoint reference taken off an inbound message may be used as the destination of a server-initiated send.

A non-anonymous response endpoint is a spec-defined WS-Addressing feature — the SOAP binding says a response SHOULD be delivered to it — but the same specification's security considerations put the burden of deciding whether to honour one on the receiver, noting that "great care should be taken before honoring a [reply endpoint] or [fault endpoint] to avoid inadvertent participation in the activities of malicious SOAP message senders". Where WS-Security is not engaged to bind the EPR to a trusted issuer, an anonymous caller otherwise chooses the address the server connects to.

Three parameters control this, resolved through the usual Axis2 chain (service, service group, then axis2.xml):

allowNonAnonymousResponseEndpoints (default false)
Off by default, so replies and faults only ever travel back down the inbound connection and an inbound header cannot name an outbound destination at all. Apache CXF made the same call for the same reason in its org.apache.cxf.ws.addressing.decoupled.enabled property. Set it to true for a deployment that genuinely uses decoupled responses — the separate-listener ("Dual") clients, or a third-party callback endpoint.
blockPrivateNetworkResponseEndpoints (default false)
Additionally rejects response endpoints that resolve to loopback, site-local/RFC-1918, IPv6 unique-local or carrier-grade-NAT addresses. This is off by default because a callback endpoint inside the same private network is how most real decoupled deployments are wired, and refusing it would break them; turn it on wherever the caller is not already inside the trusted network. Link-local, wildcard and multicast destinations are refused regardless — see resolvesToRestrictedAddress(java.lang.String, boolean, long).
allowedResponseEndpointHosts (no default)
A comma-separated host allow-list. When set, a response endpoint host must appear in it, which supersedes the network-range check.
allowedResponseEndpointSchemes (default https)
A comma-separated scheme allow-list, applied once decoupled responses are enabled at all. See DEFAULT_ALLOWED_SCHEMES for why the default is HTTPS alone.
  • Field Details

  • Method Details

    • isAllowed

      public static boolean isAllowed(EndpointReference epr, MessageContext messageContext)
      Whether the server may send to this response endpoint.

      Anonymous and null endpoints are always permitted: they mean "reply on the inbound connection" and drive no outbound connection at all.

      Parameters:
      epr - the ReplyTo or FaultTo taken from the inbound message
      messageContext - the inbound message, for parameter resolution
      Returns:
      true if the endpoint may be used as a send destination
    • shutdown

      public static void shutdown()
      Stop the resolver pool. Called from the addressing module's shutdown so the threads do not outlive the configuration that created them.
    • isDecoupledResponse

      public static boolean isDecoupledResponse(MessageContext messageContext)
      Whether this send is a WS-Addressing decoupled response: a server-side send to a destination the caller named, rather than an ordinary client-side request.

      Transports use this to decide whether to follow redirects. The scheme allow-list and the address checks in isAllowed(org.apache.axis2.addressing.EndpointReference, org.apache.axis2.context.MessageContext) run against the endpoint reference the caller supplied, and nothing re-examines where a redirect leads, so following one steps straight past them: a 307 from the caller's own endpoint to an address this policy had already refused would be honoured. A decoupled reply is fire-and-forget, so nothing legitimate depends on following a redirect.

      Parameters:
      messageContext - the message being sent; may be null
      Returns:
      whether the destination was nominated by the caller