Hi Alex,

Your code looks fine. This may be due to a behavior from Firefox in order to
prevent multiple executions of the non-idempotent POST method. I think this
would work as you expect with a GET.

Maybe you should consider pre-authenticating before submitting via POST?

Did you try with another HTTP client, like with Curl or with a Restlet
client?

Best regards,
Jerome  

> -----Message d'origine-----
> De : [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] De la 
> part de Alex Milowski
> Envoyé : mardi 10 avril 2007 22:53
> À : [email protected]
> Objet : Basic Auth & Post -- Works the second time but not the first
> 
> I've been experiencing trouble with the basic auth 
> implementation in that
> when I add a guard, the basic auth challenge is issue but the response
> does seem to be handled properly.
> 
> What happens is that the brower (e.g. Firefox) pops the dialog for
> the authentication information but the POST doesn't seem to happen
> again.  If I then request the POST again, the authenticate header
> is provided by Firefox and the POST operation succeeds (as long
> as the username/password matches).
> 
> Any ideas?
> 
> My guard looks like:
> 
>    Guard byPathGuard = new
> Guard(getContext(),ChallengeScheme.HTTP_BASIC,"Atom User") {
>          protected boolean checkSecret(String user,char [] password) {
>             ...db lookup code...
>          }
>    };
> 
> and the guarded application is added through the setNext() method.
> 
> --Alex Milowski

Reply via email to