Mike Miechowsky

Greenhorn
+ Follow
since Feb 26, 2014
Merit badge: grant badges
For More
Cows and Likes
Cows
Total received
0
In last 30 days
0
Total given
0
Likes
Total received
0
Received in last 30 days
0
Total given
0
Given in last 30 days
0
Forums and Threads
Scavenger Hunt
expand Ranch Hand Scavenger Hunt
expand Greenhorn Scavenger Hunt

Recent posts by Mike Miechowsky

For example here: https://coderanch.com/t/573039/java-EJB-SCBCD/certification/EJB-MDB-isCallerInRole
Please see last two posts.

Also in Enthuware tests, there is an explanation:

Although there is no client for a MDB, it can still call isCallerInRole and getCallerPrincipal. This is as per Table 4, Section 5.5.1 of EJB 3.1 Specification.

As per Section 17.2.5.1, "getCallerPrincipal returns the principal that represents the caller of the enterprise bean, not the principal that corresponds to the run-as security identity for the bean, if any."

If the security identity has not been established getCallerPrincipal() will return a non-null principal that corresponds to container’s representation of the unauthenticated identity.



Unless there is something I don't get... I am a little confused, to be honest, about these two methods when invoked from within MDB method.
I found out that Java Ranch learning materials says that getCallerInRole and getCallerPrincipal will throw exception when called by MDB. As it has been explain before on the forum it's not true. Maybe it would be good to correct this learning notes?

I am talking about: https://coderanch.com/how-to/java/ScbcdLinks, section "Notes and Information", position "Frits Walraven OCPEJBD 6 EJB 3.1 notes", page 2-14.