cxf-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Chris Campbell <ccampb...@quaris.com>
Subject Re: basic auth question
Date Fri, 31 Aug 2007 17:13:14 GMT
The AuthorizationPolicy is null in the server interceptor.

Now my client does this

BindingProvider bp = (BindingProvider)client;		
java.util.Map<String, Object> context = bp.getRequestContext();		
context.put(javax.xml.ws.BindingProvider.USERNAME_PROPERTY, "foouser");
context.put(javax.xml.ws.BindingProvider.PASSWORD_PROPERTY, "foopass");

My server interceptor does this (it is a Phase.USER_LOGICAL in
interceptor)

// policy is always null here...
AuthorizationPolicy policy = message.get(AuthorizationPolicy.class);
String username = policy.getUserName();
String password = policy.getPassword();

Thanks.

Daniel Kulp wrote:
> On Thursday 30 August 2007, Chris Campbell wrote:
>> On client I have:
>>
>> java.util.Map<String, Object> context =
>> 	((javax.xml.ws.BindingProvider)client).getRequestContext();
>> context.put("username", "chris");
>> context.put("password", "foobar");
>>
>> How do I access that context on the server side in my interceptor? I
>> cannot seem to find where it is in the Message object, or am I
>> horribly misunderstanding something?
> 
> With those keys, they wouldn't get to the server.    You would need to 
> use the BindingProvider.* keys.
> 
> On the server side in an interceptor, you should be able to do:
> AuthorizationPolicy policy = message.get(AuthorizationPolicy.class);
> 
> 

Mime
View raw message