• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

Securing a servlet based on request params

 
Greenhorn
Posts: 3
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi, using J2EE security in web.xml, can you secure a servlet based on request params?

server/app/dostuffservlet?page=Circle granted to role(s)
server/app/dostuffservlet?page=Square granted to other role(s)

Or does the dostuffservlet always have to be granted to the same role(s)?

Also, will this work if the request params are listed in a different order?

I.e. server/app/dostuffservlet?day=Monday&page=Circle

Thanks for the help.
 
Sheriff
Posts: 13411
Firefox Browser VI Editor Redhat
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
You'd have to tell us a little more about what you mean by "Secure a servlet"
 
Nicola Gustavson
Greenhorn
Posts: 3
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I mean, can you assign the same servlet to two different auth-constraints, like this:
 
Ben Souther
Sheriff
Posts: 13411
Firefox Browser VI Editor Redhat
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I would have to double check but, to the best of my knowledge, the servlet spec does not consider the query string part of the url-pattern for the purpose of mapping.

If you plan on doing this test it, not only in the container that you're using but any that you plan to support (as well as versions of those containers) and, unless you find something in the spec that specifically states that query strings are considered, plan on re-testing for every future version of each container you plan to support.

 
Nicola Gustavson
Greenhorn
Posts: 3
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Thanks for your reply, Ben! That helps a lot.

I would also like to find some formal documentation on this subject (how the URL is parsed), if possible. Do you have any pointers on where I might look?
 
Ben Souther
Sheriff
Posts: 13411
Firefox Browser VI Editor Redhat
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
There is a link to the servlet spec in my signature.
 
With a little knowledge, a cast iron skillet is non-stick and lasts a lifetime.
reply
    Bookmark Topic Watch Topic
  • New Topic