Hi, I'm trying to retrieve the credentials set in by HttpClient in my Restlet
service.
I'm using Mule 2.0.2 with 1.1.3 of the Mule Restlet Transport (uses Restlet
1.1.1).
In my Guard class, request.getChallengeResponse() is return null.
My Guard extension:
public class MyGuard extends Guard {
@Override
public int authenticate(Request request) {
...
ChallengeResponse cr = request.getChallengeResponse(); // is null
here
...
}
}
My Application class:
public class MyApplication extends Application {
@Override
public Restlet createRoot() {
Guard guard = new MyGuard(getContext(), ChallengeScheme.HTTP_BASIC,
"someRealm");
guard.setNext(MyResource.class);
...
}
}
I'm using HttpClient 3.1 (with Groovy) as my users will be:
def client = new HttpClient()
def httpMethod = new GetMethod(uri)
def authScope = new AuthScope(null, -1, "someRealm")
def credentials = new UsernamePasswordCredentials(username, password)
client.getState().setCredentials(authScope, credentials);
// these lines print out what I expect
println "Username: " +
client.getState().getCredentials(authScope).getUserName()
println "Password: " +
client.getState().getCredentials(authScope).getPassword()
httpMethod.setDoAuthentication(true)
statusCode = client.executeMethod(httpMethod);
I found a similar posting here:
http://markmail.org/message/6n7hjc3pmbg7vcg5#query:restlet%20httpclient%20credentials+page:1+mid:5y3ldjbvcvwxaysp+state:results
Thanks for advance for any insight.
------------------------------------------------------
http://restlet.tigris.org/ds/viewMessage.do?dsForumId=4447&dsMessageId=1051918