This week's book giveaway is in the Jobs Discussion forum.
We're giving away four copies of Java Interview Guide and have Anthony DePalma on-line!
See this thread for details.
The moose likes Tomcat and the fly likes How to use  Request.isUserInRole method? Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login

Win a copy of Java Interview Guide this week in the Jobs Discussion forum!
JavaRanch » Java Forums » Products » Tomcat
Bookmark "How to use  Request.isUserInRole method?" Watch "How to use  Request.isUserInRole method?" New topic

How to use Request.isUserInRole method?

Dave Bosky
Ranch Hand

Joined: Dec 16, 2003
Posts: 72
I want to use the standard J2EE construct HttpRequest.isUserInRole() in my web application. I understand how to check if the user is in a particular role by using if (request.isUserInRole(roleType)) { this....}.

How do I assign the roles to the user when they login so I can use the method above? I'm using Tomcat5 and W2K.

Nathaniel Stoddard
Ranch Hand

Joined: May 29, 2003
Posts: 1258
You should consult the Tomcat documentation for how to do this. Basically, you'll need to create a protected resource collection in your deployment descriptors, create roles in your deployment descriptors, create some database or other data store whose data will be consulted when a user logs into the protected area of your web application, and that's it.

What roles belong to an individual when they authenticate themselves to the application is specified in the database, or however you set it up in Tomcat. Check out the docs. It's pretty simple.

Bear Bibeault
Author and ninkuma

Joined: Jan 10, 2002
Posts: 63870

Moving to the Tomcat forum.

[Asking smart questions] [About Bear] [Books by Bear]
I agree. Here's the link:
subject: How to use Request.isUserInRole method?
It's not a secret anymore!