Win a copy of Kubernetes in Action this week in the Cloud/Virtualization forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

auth-constraint doubt  RSS feed

 
Ranch Hand
Posts: 163
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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?
 
Creator of Enthuware JWS+ V6
Saloon Keeper
Posts: 3064
248
Android Chrome Eclipse IDE
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator

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
Posts: 163
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Saloon Keeper
Posts: 3064
248
Android Chrome Eclipse IDE
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator

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
Posts: 163
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Got it
 
It is sorta covered in the JavaRanch Style Guide.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!