It's not a secret anymore!*
The moose likes Web Component Certification (SCWCD/OCPJWCD) and the fly likes auth-constraint doubt Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Certification » Web Component Certification (SCWCD/OCPJWCD)
Bookmark "auth-constraint doubt" Watch "auth-constraint doubt" New topic
Author

auth-constraint doubt

Parth Twari
Ranch Hand

Joined: Jan 20, 2010
Posts: 163
Given a deployment descriptor with three valid <security-constraint> elements, all constraining web resource AX, whose respective <auth-constraint> sub-elements are:



<auth-constraint>*</auth-constraint>
<auth-constraint>Bob</auth-constraint>
<auth-constraint>Alice</auth-constraint>


Who can access resource AX?

A.no one
B.all
C.only bob
D.only alice
E.bob and alice

Source :SAI

the given answer is B

But I think there will be an error because there is not role-name element within the auth-constraint element.
Right?

Parth Tiwari
| Pursuing Bachelor of Engineering | OSUM Club Leader | SCJP 6 | SCWCD 5 |...
Frits Walraven
Creator of Enthuware JWS+ V6
Bartender

Joined: Apr 07, 2010
Posts: 1632
    
  23

But I think there will be an error because there is not role-name element within the auth-constraint element.
Right?

Yes, you must have a <role-name> around the role's

Regards,
Frits
Parth Twari
Ranch Hand

Joined: Jan 20, 2010
Posts: 163
ok thanks ..

but when we test it in tomcat it does not show error in DD during server startup
instead it says
Acces to resource is denied


where can I see that error has been raised?
Frits Walraven
Creator of Enthuware JWS+ V6
Bartender

Joined: Apr 07, 2010
Posts: 1632
    
  23

where can I see that error has been raised?

There is no error: as you haven't got the <role-name> element inside a <auth-constraint> element, the server takes this as an empty <auth-constraint />, meaning: no one is allowed

It seems Tomcat doesn't mind having text inside the body of the <auth-constraint> element.....

Regards
Frits
Parth Twari
Ranch Hand

Joined: Jan 20, 2010
Posts: 163
Got it
 
It is sorta covered in the JavaRanch Style Guide.
 
subject: auth-constraint doubt
 
Similar Threads
doubt in auth-constraint
HFS Mock Exam - Q29 - Is the question correct? - Auth-constraint
<web-resource-collection>
jdiscuss Question A day Oct. 9
<auth-constraint>