RE: Using Authenticate/Challenge to get User Name and Password

David Pepper writes:
 > 
 > Anselm,
 > 	Thanks for your response.  I had tried something similar to what
 > you suggested but wasn't able to get the desired results.  What I did
 > was to use the code fragment from GenericAuthFilter as part of my
 > "public Reply get" method of my Java resource as follows:
 > 
 >  public Reply get (Request request)
 >     throws HTTPException
 >   {
 >     HtmlGenerator g = new HtmlGenerator ("VVMResource") ;
 > 
 >     // If we can't interact, we can't help:
 >    
 > // I thought I needed this here, but I may be wrong...

I don't think you need this either...(at least not from that excerpt
of your code)

 > ...
 >         // got a response from the BasicAuthContext...
 > // This is where I want to be able to get to -- or, I could use a Filter
 > // resource as long as I can querry it for the entered user name /password

I guess the thing you are really looking for is the following: the
GenericAuthFilter saves in the request these additional variables:

w3c.jigsaw.auth.AuthUser.STATE_USER
    Will provide you the user name
w3c.jigsaw.auth.AuthUser.STATE_AUTHTYPE
    The type of authentication used 

To access any of these variables, use:

request.getState(w3c.jigsaw.auth.AuthUser.STATE_USER)
request.getState(w3c.jigsaw.auth.AuthUser.STATE_AUTHTYPE)

This will return (resp) the user name, and the auth type used.

Is this what you were looking for ? BTW That's a more general way for
filters to provide some infos (eg the COunterFilter uses a similar
trick to give access to the hit count)

Anselm.

Received on Thursday, 5 December 1996 03:59:22 UTC