aspose file tools*
The moose likes EJB Certification (SCBCD/OCPJBCD) and the fly likes Security - Principal & run-as-identity Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Spring in Action this week in the Spring forum!
JavaRanch » Java Forums » Certification » EJB Certification (SCBCD/OCPJBCD)
Bookmark "Security - Principal & run-as-identity" Watch "Security - Principal & run-as-identity" New topic
Author

Security - Principal & run-as-identity

Deepika Joshi
Ranch Hand

Joined: Feb 24, 2009
Posts: 268
Source - One of choice of a question from Whizlab.


Method getCallerPrincipal returns the principal represents the caller of EJB which is same as the principal that corresponds to run-as-secutiry identity of bean, if exists.
FALSE

Reason
It is not mandatory that principal that corresponds to run-as-identity for the bean should be same as principal that represents the caller of the bean.

Can someone please add few more words to the reason, bit hard to understand for me.

Thanks.
Ralph Jaus
Ranch Hand

Joined: Apr 27, 2008
Posts: 342
It is not mandatory that principal that corresponds to run-as-identity for the bean should be same as principal that represents the caller of the bean.

In fact, the only reason for using a run-as-identity, is to perform subsequent bean invocations under a new principal / security role.

You may have a look at the code example in the following link: The principal that represents the caller of ABean has role "Guest" (at least if he should be allowed to invoke aMethod) while the run-as-identity corresponds to a principal with role "Admin".


SCJP 5 (98%) - SCBCD 5 (98%)
Deepika Joshi
Ranch Hand

Joined: Feb 24, 2009
Posts: 268
Sorry it's my mistake, I forgot the first rule of cert preparation.
"Read options carefully."

run-as-identity is @RunAs, I did not read & applied my mind carefully.

Thanks a lot for replying.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Security - Principal & run-as-identity