File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
The moose likes Servlets and the fly likes Authentication attempts and the session... Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Servlets
Bookmark "Authentication attempts and the session..." Watch "Authentication attempts and the session..." New topic

Authentication attempts and the session...

Timothy Stone
Ranch Hand

Joined: Aug 01, 2001
Posts: 71
I'm playing with a servlet that is "protected" behind a BASIC authentication response.
The number of attempts are next to limitless, unless I set up an "attempts counter." Making it a private field is not an option as it crosses users, sessions, etc.
Putting the counter on the session seems the way to go. Anybody consider this a bad practice, best practice? And is the overhead of getting and setting the object on the session high?

Timothy Stone, MIT, SCJP
"This Satan's drink [coffee] is so delicious, we shall cheat Satan and baptize it." --Pope Clement the VIII (1592-1605)
Mike Curwen
Ranch Hand

Joined: Feb 20, 2001
Posts: 3695

disclaimer: I'm thinking out loud.

The 'thing' that does the authentication is the Tomcat container. So you'd need to keep track of login attempts through BASIC auth through there, right?

Also.. is there such a thing as a Session before a user logs in? I know there is jsessionid when browsers don't have cookies. But BASIC auth happens (or should?) before this point. Or does it?

More questions.. no answers.
I agree. Here's the link:
subject: Authentication attempts and the session...
jQuery in Action, 3rd edition