• 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

Security, run-as and other stuff

 
Ranch Hand
Posts: 244
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Greetings,
I have a great confusion about security.

Let's suppose that:
1. There's a stateless session bean A with methodA()
2. There's a stateless session bean B with methodB()
3. There's a stateless session bean C with methodC()
4. There's a client which runs as user 'JavaRanchUser' and role 'Rancher'
and invokes A.methodA()
5. methodA() invokes B.methodB()
6. methodB() invokes C.methodC()
7. B.methodB() has @RunAs("Sheriff")

Now, what is the result of the getCallerPrincipal(), isUserInRole("Rancher") and isUserInRole("Sheriff") during the execution of methodA(), methodB() and methodC()?

Thanks in advances
 
Ranch Hand
Posts: 185
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
In all the methods, getCallerPrincipal() will return "JavaRanchUser", isUerInRole("Rancher") will return true and isUserInRole("Sheriff") will return false.

Even I had this confusion, which Christophe cleared it here: https://coderanch.com/t/163793/java-EJB-SCBCD/certification/security-violation

Is my answer right, Christophe?
 
Mirko Bonasorte
Ranch Hand
Posts: 244
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Great! Thanks!
 
reply
    Bookmark Topic Watch Topic
  • New Topic