File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

How to use Request.isUserInRole method?

 
Dave Bosky
Ranch Hand
Posts: 72
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 1258
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Marshal
Pie
Posts: 64196
83
IntelliJ IDE Java jQuery Mac Mac OS X
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Moving to the Tomcat forum.
 
I agree. Here's the link: http://aspose.com/file-tools
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic