Hi there,

You need to use the other Guard constructor taking four parameters.

Best regards,
Jerome Louvel
--
Restlet ~ Founder and Lead developer ~ http://www.restlet.org
Noelios Technologies ~ Co-founder ~ http://www.noelios.com


-----Message d'origine-----
De : news [mailto:[EMAIL PROTECTED] De la part de D Desai
Envoye : mardi 12 aout 2008 19:22
A : [email protected]
Objet : Http Digest

I am new to Restlet and am trying to get Http Digest authentication to work
(I
currently get a 401 everytime). 

I create the guard as follows:
 
Guard g = new Guard(getContext(),ChallengeScheme.HTTP_DIGEST, "someRealm");

g.getSecrets().put("userName", "somePassword".toCharArray());

 
The relevant client code is:

Request request = new Request(Method.PUT, url, fr );//url of the server and
a
representation of a file.

ChallengeScheme scheme = ChallengeScheme.HTTP_DIGEST;

ChallengeResponse authentication = new ChallengeResponse(scheme,"userName",
"somePassword");
  
request.setChallengeResponse(authentication);
  
// Ask to the HTTP client connector to handle the call Client client = new
Client(Protocol.HTTP); Response response = client.handle(request);

 
This works if I change the ChallengeScheme to ChallengeScheme.HTTP_BASIC.


Reply via email to