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

User authentication

Matvey Raz

Joined: Jul 18, 2013
Posts: 1
I'm new on Tomcat, and I am writing my first web application now.
I need to protect some pages with username and password.
Once user logged in, he should access all those (protected) pages without re-login, until the browser (or tab) is closed.
When user re-opens the browser (or tab) and tries to access those pages, he need to login again.
What is the simplest way to do this ?
Ulf Dittmer

Joined: Mar 22, 2005
Posts: 42965
That's what realms and container-managed security is for. Besides setting up users, roles and passwords in one of the ways described there, some changes to your web.xml that describe which URLs to protect may be all you need.
Tim Holloway
Saloon Keeper

Joined: Jun 25, 2001
Posts: 17421

"Matvey Rrr",

We don't have many rules here at the JavaRanch, but we do insist that you use your Real Name and not some sort of "handle" or obvious alias. If you're not sure about this, see .

An IDE is no substitute for an Intelligent Developer.
I agree. Here's the link:
subject: User authentication
It's not a secret anymore!