I came up with a really dodgy solution that actually works :-)

https://github.com/pellcorp/cxf/blob/master/JavaFirst/src/main/java/com/pellcorp/client/HttpsConduitAlternativeSelector.java

I loaded up a list of all jaxws clients.

I used reflection to get hold of the endpoint info from the conduit passed
to the AlternativeSelector, so I can then find the related client by
comparing the endpoint info instances.

I can then get access to the JaxwsEndpointImpl properties.

So I create two clients, one which uses password auth, the other uses the
default, (which could be saml if a mutual ssl tunnel is active, or password
if not)

I define a property in the jaxws:client

<jaxws:properties>
            <entry key="preferred.auth.method" value="UsernamePassword" />
        </jaxws:properties>

I know it's nasty and I plan to get rid of it once we can upgrade to cxf 3,
but I think it should suffice for now




On Fri, Oct 10, 2014 at 11:01 AM, Jason Pell <[email protected]> wrote:

> I can't upgrade to 3.x as yet. So I need to figure out a way to do this in
> 2.7.
> On 10/10/2014 4:18 AM, "Daniel Kulp" <[email protected]> wrote:
>
>>
>> On Oct 9, 2014, at 5:41 AM, Jason Pell <[email protected]> wrote:
>>
>> > For instance I want to force choosing username password token for one
>> > method call and then a saml bearer token for all others.
>> >
>> > I don't have enough info in the assertor http conduit
>>
>> In the AlternativeSelector for CXF 3.0.x, we added the Message as a
>> parameter.   Thus, you should be able to look at the operation being called
>> and select different alternatives.   That param was added to specifically
>> address this type of use case.  (as well as ability to look in the message
>> to see if things like usernames/passwords are available and maybe select a
>> different alternative if not).
>>
>>
>>
>> --
>> Daniel Kulp
>> [email protected] - http://dankulp.com/blog
>> Talend Community Coder - http://coders.talend.com
>>
>>

Reply via email to