Hi All, I was going through the security chapter 12 of HFSJ and got a weird as it get doubt on duelling <auth-constraint> elements. I was wondering what if we have two <security-constraint> tags for the same <url-pattern> or overlapping one as they say with the following: <auth-constraint/> in one and <auth-contraint> <role-name>*</role-name> which is same as no <auth-contraint> tag at all </auth-contraint>
Thanks & Regards, Abhishek
"I may not have gone where I intended to go, but I think I have ended up where I needed to be"<br /> <br />"He felt that his whole life was some kind of dream and he sometimes wondered whose it was and whether they were enjoying it"<br /> <br />--by Douglas Adams<br /> <br />[SCJP - 96%, SCWCD - 88%, SCBCD - May 2008]
My first point would be: have you tried this to see what happens? What output did you get from your trial?
Secondly, you would find the answer very easily by looking at the Servlet specs.; p.98 would sort you.
I strongly dislike the statement "the union of all and none is none"... mathematically speaking (from set theory) this is completely inaccurate: the union of all and none (the empty set) is all. The intersection of all and none is none. The use of "union" in this context is therefore misleading; instead, the Servlet spec. goes with "combine".
<auth-constraint/> in one and <auth-contraint> <role-name>*</role-name> which is same as no <auth-contraint> tag at all </auth-contraint>
Using * is not the same as using no constraint at all: the use of * means the resource(s) is/are "constrained to all authenticated users". The absence of a constraint means the resource(s) is/are available "to all users, regardless of whether they're authenticated [logged in] or not".
Charles Lyons (SCJP 1.4, April 2003; SCJP 5, Dec 2006; SCWCD 1.4b, April 2004)
Author of OCEJWCD Study Companion for Oracle Exam 1Z0-899 (ISBN 0955160340 / AmazonAmazon UK )
Won't you please? Please won't you be my neighbor? - Fred Rogers. Tiny ad:
Building a Better World in your Backyard by Paul Wheaton and Shawn Klassen-Koop