Message |
williamc@paneris.org writes: > tim@hoop.co.uk writes: > > I have never really understood how apache user authentication works, but I > > assume that it is similar to the way we handle it (valid password -> start a > > session so that users don't have to log in to every page). > > > > How is this session supported, and can we 'get at it'? > > It's part of HTTP. > See http://info.internet.isi.edu/in-notes/rfc/files/rfc2068.txt > section 11.1 "Basic authentication scheme". > > I can't on the face of it see any reason why we shouldn't leverage > it. > > for our billing purposes we need to get at the loginid, does this come back > > on a HTTP request? > > Yes, it's HttpServletRequest.getRemoteUser(). I don't see why we > can't use HttpServletResponse.setHeader() to implement a password > challenge, either. Will look into. I tried this out. getRemoteUser() always appears to return null with JServ (it's useless on its own anyway since you need the password!). Basically if you sent a 401 response back to Netscape, it prompts you for a username and password, and then forever sends those in the Authorization header to the server. You have to decode them from base64 and they are padded with zeroes to eight characters (yurgh). Netscape 4.61/Linux appears as far as I can tell _not_ to use the "protection space" idea to reissue login/password pairs the user has previously told it about when challenged for the same "realm" in the future. But that doesn't matter to us. We could look into the digest authentication system but it's unlikely to be supported by old browsers or (perhaps) by phones. Attached is code for playing around.
|