• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Cobian Q41 Doubts

 
Rufus BugleWeed
Ranch Hand
Posts: 1551
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Q 41 Given the following declaration
<security-role-ref>
<role-link>linkedRole</role-link>
<role-name>roleName</role-name>
</security-role-ref>
Which method call is correct?
1) isUserInRole(linkedRole)
2) isUserInRole(roleName)
Cobian says answer is 2.
From Sun's Tutorial
Sun J2EE TUTORIAL Security
In this example, isUserInRole("bankCustomer") and isUserInRole("cust") will both return true for the methods indicated in the Method Permissions pane.
I am thinking answer is 1 and 2. Any one have a different opinion?
 
Vikrama Sanjeeva
Ranch Hand
Posts: 760
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Where can i get Cobian's Mock?
Bye.
Viki.
 
Mark Spritzler
ranger
Sheriff
Posts: 17278
6
IntelliJ IDE Mac Spring
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Well, I believe that the role-link represents the user that is in "Code", where as the role-name is the role-name used in the web.xml under security-role tag, which is not assessible from your servlet code.
I might be wrong.
Mark
 
Axel Janssen
Ranch Hand
Posts: 2166
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Mark.
I say: You are right.
With this
<security-role-ref>
<role-name>roleInCode</role-name>
<role-link>roleInTomcat-users.xml</role-link>
</security-role-ref>

construct,
the deployer can use different role-names from those chosen by the programmer.
not 100% sure. Correct me if I am wrong.
Axel
[ February 27, 2002: Message edited by: Axel Janssen ]
 
Guy Allard
Ranch Hand
Posts: 776
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Originally posted by Rufus Bugleweed:
Q 41 Given the following declaration
<security-role-ref>
<role-link>linkedRole</role-link>
<role-name>roleName</role-name>
</security-role-ref>
Which method call is correct?
1) isUserInRole(linkedRole)
2) isUserInRole(roleName)
Cobian says answer is 2.
From Sun's Tutorial
Sun J2EE TUTORIAL Security
In this example, isUserInRole("bankCustomer") and isUserInRole("cust") will both return true for the methods indicated in the Method Permissions pane.
I am thinking answer is 1 and 2. Any one have a different opinion?


Seems to me, if that is exactly the question from the mock, then you do not answer it, because the correct answer is "none of the above". There will be a parse exception at container start, because the role-link and role-name tags are reversed from the DTD specified order.
G.
 
Rufus BugleWeed
Ranch Hand
Posts: 1551
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
In response to
Where can i get Cobian's Mock?
It's on the SCWCD links page.
To the others, thanks for your input.
[ February 28, 2002: Message edited by: Rufus Bugleweed ]
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic