I'm able to successfully use the following code:
ClientConfig clientConfig = new ClientConfig();
clientConfig.applications(application);
RestClient client = new RestClient(clientConfig);
Resource resource = client.resource(httpRequest.getHeader(IDENTITY_URL));
resource.header("Authorization", "Bearer " +
httpRequest.getHeader(ACCESS_TOKEN));
ClientResponse response =
resource.accept(MediaType.APPLICATION_JSON_TYPE).get();
- Chris Harris
From: Erich Bremer [mailto:[email protected]]
Sent: Tuesday, April 29, 2014 6:23 AM
To: [email protected]
Subject: BasicAuthSecurityHandler not working
Hi, I am trying to get BasicAuthSecurityHandler working with the Apache Wink
client using the following code but it does not seem to work:
ClientConfig config = new ClientConfig();
BasicAuthSecurityHandler auth = new BasicAuthSecurityHandler();
auth.setUserName("username");
auth.setPassword("password");
config.handlers(auth);
RestClient client = new RestClient(config);
Resource resource = client.resource("http://requestb.in/19qKpb1");
ClientResponse response =
resource.contentType(MediaType.APPLICATION_JSON).accept(MediaType.APPLICATION_JSON).get();
After sending this to requestbin to see what is being sent, no Authorization
headers seem to be sent. Am I missing something?
[https://mail.google.com/mail/u/0/images/cleardot.gif]
- Erich
The information transmitted is intended only for the person(s) or entity to
which it is addressed and may contain confidential and/or legally privileged
material. Delivery of this message to any person other than the intended
recipient(s) is not intended in any way to waive privilege or confidentiality.
Any review, retransmission, dissemination or other use of, or taking of any
action in reliance upon, this information by entities other than the intended
recipient is prohibited. If you receive this in error, please contact the
sender and delete the material from any computer.
For Translation:
http://www.baxter.com/email_disclaimer