5

I use JAXRSClientFactory.create method to create proxy like this:

IMyService myService 
 = JAXRSClientFactory.create("http://myserviceurl/", IMyService.class, "login1", "pwd", null);

and this code work ok.

After that I need to use this service with another credentials and I try to create same service with another credentials like this:

IMyService myNewService 
 = JAXRSClientFactory.create("http://myserviceurl/", IMyService.class, "login2", "pwd", null);

this code work, but work with wrong credentials (with credentials from first service). I didn't found any way to change it (reset, or clear, or something like this).

And one more detail, this issue only with digest authorization. With basic it works well.

Could anybody help me with this issue.

Thanks.

kvieserc
  • 166
  • 5
  • I think that `myNewService` is using the same HTTP session that `myService`, but I can't find anything in the interwebs about how to force a new session – isalgueiro Sep 30 '14 at 08:19

2 Answers2

0

Maybe something like this should work :

Endpoint endpoint = WebClient.getConfig(client).getEndpoint();
AuthorizationPolicy policy = endpoint.getEndpointInfo().getExtensor(AuthorizationPolicy.class)
policy.setUserName("login2");
Mektoub
  • 116
  • 11
0

How does digest auth work with JAXRSClientFactory.create? According to the description of the API, the method is used in order to get a client with basic authentication.

Rambo Amadeus
  • 51
  • 1
  • 2