Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

HTTP authorization log out

 
Greenhorn
Posts: 10
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Report post to moderator
Hi,

I'm new at using the HTTP request authorization header for user authentication, so please bear through this newbie question.

I know I can pop-up an authenticate window in a browser session with the following code snippet:

public void doGet(HttpServletRequest request, HttpServletResponse response)
throws ServletException, IOException {
//...
response.setStatus(HttpServletResponse.SC_UNAUTHORIZED);
response.setHeader("WWW-Authenticate", "BASIC realm=\"privileged-user\"");
//...
}

I also know how to parse to returning username and password to authenticate the request. So this is okay.

However, I do not know is how to log out of this authorized session without closing the browser. Well, that's not entirely true. I do seem to be able to log out by resending those two response headers, but I get a problem where the first authentication window that pops up won't accept an appropriate username and password. If I cancel the first request, then try to return to the site, the next authentication window responds as expected.

So I'm a little confused at what I'm doing wrong. Any suggestions?

Thanks,

- Greg.
 
Rancher
Posts: 13459
Android Eclipse IDE Ubuntu
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Report post to moderator
This is actually a reasonable question - not as silly as it sounds.

We have an existing thread discussing this here.

Dave
 
David O'Meara
Rancher
Posts: 13459
Android Eclipse IDE Ubuntu
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Report post to moderator
I hope you don't mind that I'm closing this thread to prevent duplicate conversations.

Dave
 
    Bookmark Topic Watch Topic
  • New Topic