Hi Dan,
yes, the correct code is:
MessageContext ctx = (MessageContext) wsContext.getMessageContext();
List recv = (List)ctx.get("RECV_RESULTS");
WSHandlerResult wsResult = (WSHandlerResult)recv.get(0);
WSSecurityEngineResult wsseResult =
(WSSecurityEngineResult)wsResult.getResults().get(0);
Principal principal =
(Principal)wsseResult.get(WSSecurityEngineResult.TAG_PRINCIPAL);
principal.getName();
Thanks!
dkulp wrote:
>
>
>
> In your interceptor, if you call
> message.put("foo", someObject);
>
> That object will be available in the wsContext via
> wsContext.get("foo"). Thus, you can put whatever you want in there.
>
> Our ws-security interceptor puts several things in there. I think
> you can call wsContext.get("RECV_RESULTS") to get a Vector of the
> WSS4J result objects from which you can query a bunch of things.
>
> Dan
>
>
> On Jun 3, 2008, at 5:20 PM, bgbraga wrote:
>
>>
>> I don't use JAAS.
>> I use WS-Security (UsernameToken) and need to pass the username of
>> intercepting to web-services.
>>
>> How to implement it using cxf?
>>
>> thanks!
>>
>>
>> bgbraga wrote:
>>>
>>> good =)
>>>
>>> but wsContext.getUserPrincipal() is null :/
>>> I have to set UserPrincipal ?
>>>
>>> thanks!
>>>
>>>
>>> dkulp wrote:
>>>>
>>>>
>>>> In a JAX-WS service, if you add a field like:
>>>> @Resource
>>>> WebServiceContext context;
>>>>
>>>> The context will get injected into your service. From there, you
>>>> can
>>>> query and properties that you set on the message object in an
>>>> interceptor.
>>>>
>>>> Dan
>>>>
>>>>
>>>> On May 30, 2008, at 9:38 PM, bgbraga wrote:
>>>>
>>>>>
>>>>> Hi,
>>>>>
>>>>> I need to get the username of soapheader (interceptor) and send
>>>>> to my
>>>>> web-services class.
>>>>>
>>>>> How to implement this communication in cxf? There is some message
>>>>> context
>>>>> for this?
>>>>>
>>>>> I used org.apache.axis.MessageContext class in axis.how to send an
>>>>> attribute
>>>>> of interceptor to web-services operation?
>>>>> --
>>>>> View this message in context:
>>>>> http://www.nabble.com/how-to-send-an-attribute-of-interceptor-to-web-services-operation--tp17570751p17570751.html
>>>>> Sent from the cxf-user mailing list archive at Nabble.com.
>>>>>
>>>>
>>>> ---
>>>> Daniel Kulp
>>>> [EMAIL PROTECTED]
>>>> http://www.dankulp.com/blog
>>>>
>>>>
>>>>
>>>>
>>>>
>>>>
>>>
>>>
>>
>> --
>> View this message in context:
>> http://www.nabble.com/how-to-send-an-attribute-of-interceptor-to-web-services-operation--tp17570751p17633980.html
>> Sent from the cxf-user mailing list archive at Nabble.com.
>>
>
> ---
> Daniel Kulp
> [EMAIL PROTECTED]
> http://www.dankulp.com/blog
>
>
>
>
>
>
--
View this message in context:
http://www.nabble.com/how-to-send-an-attribute-of-interceptor-to-web-services-operation--tp17570751p17647860.html
Sent from the cxf-user mailing list archive at Nabble.com.