This week's book giveaway is in the Servlets forum.
We're giving away four copies of Murach's Java Servlets and JSP and have Joel Murach 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 Murach's Java Servlets and JSP this week in the Servlets forum!
JavaRanch » Java Forums » Products » Tomcat
Bookmark "How to use  Request.isUserInRole method?" Watch "How to use  Request.isUserInRole method?" New topic
Author

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)) {....do 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.

Thanks,
Dave
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.


Nathaniel Stodard<br />SCJP, SCJD, SCWCD, SCBCD, SCDJWS, ICAD, ICSD, ICED
Bear Bibeault
Author and ninkuma
Marshal

Joined: Jan 10, 2002
Posts: 60761
    
  65

Moving to the Tomcat forum.


[Asking smart questions] [Bear's FrontMan] [About Bear] [Books by Bear]
 
jQuery in Action, 2nd edition
 
subject: How to use Request.isUserInRole method?
 
Similar Threads
How to use isUserInRole in jboss
Tiles and Roles
WAS AEs Security
question about user roles
Need help - Oracle JAAS Provider(JAZN)