cxf-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Dan Diephouse" <>
Subject Re: HTTP Basic Authentication Is there hope?
Date Sun, 11 Feb 2007 21:21:07 GMT
Hi Polar,

Comments inline...

On 2/11/07, Polar Humenn <> wrote:
> The current way http auth is set up in CXF is to use Spring
> configuration to on HTTPConduit, like so in a file like "client.xml".
>     <bean
> name="{}Greeter.http-conduit"
> abstract="true">
>         <property name="authorization">
>             <value>
>                 <sec:authorization>
>                     <sec:UserName>Polar</sec:UserName>
>                     <sec:Password>querty</sec:Password>
>                 </sec:authorization>
>             </value>
>         </property>
>     </bean>
> This approach looks less like "having security" and more like "getting
> around the *problem* of security".
> Aside from the *bad practice* of keeping user name/password combinations
> in unencrypted files, this approach is also subtly bad in that assumes
> that you know what servers you are going to apriori. The configuration
> of the http-conduit bean is not server specific, but type specific. I
> may very well have two different servers offering the same service. One
> trustworthy, and one rogue (collecting passwords). Confusion may ensue
> in a more dynamic environment, let's say if I get my WSDL port/endpoint
> information from an untrusted source like a UDDI server, or my dead
> grandmother. Another scenario is if I am building for example, an
> application that uses the same "standard" service offered by two
> different Banks, I can't use this approach unless I have the same
> username and password at both banks.

This is one of the things that rubs me wrong about the Configurable
approach. Something that I would like to see is an approach where we create
client beans in the spring context and use those:

<jaxws:client id="myGreeter1" class="....Greeter">

<http:conduit id="basicConduitConfig"> .... </http:conduit>

That way the http:conduit definition would only apply to that Client (or any
others you wanted it to apply to). This would be a slightly different
approach in that instead of apply XML configuration to objects you've
created outside the ApplicationContext, you would be creating objects inside
the ApplicationContext. You would then either pull the objects outside the
context via "context.getBean("myGreeter1")" or you'd inject your client into
your application somewhere.

Would that help address some concerns? I think the goal behind the current
approach was to allow you to create an Endpoint via Endpoint.publish and
just configure the HTTP part of it without having to do all the extra XML.
So its a bit of a trade off...

We would like to examine certain aspects of the endpoint before we start
> *exposing usernames and passwords to everybody* with a pretty flower.
> There is no apparent way to do this in CXF's use of HTTP.
> Furthermore, the HTTP protocol requires that a 401 status be returned
> from the server if the authorization information is not supplied or
> incorrect. The 401 response comes back with authorization challenge
> information, namely the "realm" identifier, which CXF HTTP ignores.
> Internally, CXF uses on the client side,
> which is really the implementation
> This implementation catches
> the 401 response message and attempts to authenticate [see below],
> however, it fails with the HTTPRetryException. This exception is caught
> and turned into a message fault, now allowing us to get any information.
> It fails oddly because the HTTPConduit's default is to "stream".
> Streaming is configurable on the endpoint http-conduit HTTPClientPolicy.

I can construct a complex graph of interceptors on the server side to
> send the 401 and the proper realm information. However, it fails on the
> client side in HttpURLConnection with an HTTPRetryException, on
> getInputStream, which is ignored by HTTPConduit. The error is "cannot
> retry due to server authentication while streaming".

I'm not sure what the issue is here...

As a side note, do we really think http chunking should be on by default? We
ended up making users having to turn it on in XFire because of
interoperability issues with various HTTP servers. So it makes me nervous to
default to having chunking on.

The does have an authenticator scheme that
> allows "automatic" use of Password Authentication,
> This Authenticator, (apparently only one per
> JVM), has an interface with which to query certain aspects of the site
> "requesting" authentication, such as IP address, port numbers, URL, etc.
> This object does provide differentiation of figuring out which username
> and passwords to send, but is slightly lacking in deciding trust whether
> to send them or not.
> The big question is, can we do better than this? Can we organize
> something in CXF that will allow us to use security in a good way? First
> establishing trust before sending sensitive information? Can we do this
> without solely programming everything into an XML file?
> Even this is woefully inadequate as there is now
> way too look up an SSL authentication on the HttpURLConnection.
> I don't imagine that the use of HttpURLConnection will go away inside
> CXF, but there should be some better way to "configure" or at least
> dynamically direct the HTTPConduit in use for a particular endpoint.
> Would it be beneficial to the team for me to spend time on proposing a
> good security solution?

If you would like to propose a better option I am all for it. I am no
security expert, but would a callback mechanism help address some of the
concerns? I wonder if we can create a mechanism that works well with both
transport level security and message level security (i.e. ws-security).

Thanks for bringing these things up, these are definitely issues!

- Dan

P.S. - Is it necssary to CC a private mailing list that not everyone can

Dan Diephouse
Envoi Solutions |

  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message