- From: Anselm Baird_Smith <abaird@www43.inria.fr>
- Date: Tue, 21 Jan 1997 11:14:49 +0100 (MET)
- To: "S. Alexander Jacobson" <alex@interband.com>
- Cc: www-jigsaw@www10.w3.org
S. Alexander Jacobson writes:
> Hi,
>
> I want to create a resource that simply prints the name of the auth-user
> if it is behind a genericAuthFilter.
>
> Ideally I would like a method like access to the complete AuthUser for the
> current request.
>
> I have looked through the documentation and found no elegant way to do
> that other than uudecode the authorization mime header. I have to assume
> that someone has already implemented a better solution.
[I guess my mail arrived out of order]
Here is what you are looking for (mail quality code):
public AuthDisplay extends FilteredResource {
public Reply get(Request request)
throws HTTPException
{
Reply reply = createDefaultReply(request, HTTP.OK);
String u = null;
u = request.getState(w3c.www.jigsaw.auth.AuthFilter.STATE_SUATHUSER);
reply.setContent((u == null) ? "no user" : u);
return reply;
}
}
Pretty easy, isn't it :-)
Anselm.
Received on Tuesday, 21 January 1997 05:15:00 UTC