How to Return a HTTP 401 instead of a CXF SOAP fault for basic authentication failure?

Solution Verified - Updated -

Issue

Some clients require a response from the server to trigger basic authentication instead of proactively sending basic authentication credentials on the first request. The CXF login filter, by default, sends an HTTP 500 error with SOAP fault if basic authentication credentials are not sent.

<soap:Envelope xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/">
  <soap:Body>
    <soap:Fault>
      <faultcode>soap:Server</faultcode>
      <faultstring>Authentication required but no user or password was supplied</faultstring>
    </soap:Fault>
  </soap:Body>
</soap:Envelope>

Environment

  • Red Hat JBoss Fuse
    • 6.2.1
  • Apache CXF
  • Apache Aries/Blueprint

Subscriber exclusive content

A Red Hat subscription provides unlimited access to our knowledgebase of over 48,000 articles and solutions.

Current Customers and Partners

Log in for full access

Log In
Close

Welcome! Check out the Getting Started with Red Hat page for quick tours and guides for common tasks.