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, tools, and much more.

Current Customers and Partners

Log in for full access

Log In

New to Red Hat?

Learn more about Red Hat subscriptions

Using a Red Hat product through a public cloud?

How to access this content