This week's book giveaways are in the iOS and Features new in Java 8 forums. We're giving away four copies each of Barcodes with iOS: Bringing together the digital and physical worlds and Core Java for the Impatient and have the authors on-line! See this thread and this one for details.
The spec says that in ejbCreate, ejbRemove, ejbActivate and ejbPassivate you can call from the SessionContext the isCallerInRole and getCallerPrincipal but with ejbActivate and ejbPassivate there is no direct caller.
Is this right that calls to isCallerInRole and getCallerPrincipal are allowed in ejbActivate and ejbPassivate?
The spec says so, so it must be, but there is no caller for these methods.
Invoking the getCallerPrincipal and isCallerInRole methods is disallowed in the session bean methods for which the Container does not have a client security context.
For a SFSB instance there is a client security context when Container executes ejbActivate/ejbPassivate as stateful session bean is always associated with a particular client since its creation (i.e. since an instance of the bean has been created with the call to ejbCreate method)
Therefore, one can invoke security related methods on SessionContext when Container passivates/activates an instance of SFSB.
Alex (SCJP 1.4, SCBCD 1.3, SCWCD 1.4, SCJD 1.4)
Joined: May 10, 2004
Thank you for your reply, I thought the client security context, like a transaction context was propagated as per call.