Get your CodeRanch badge!*
The moose likes EJB and other Java EE Technologies and the fly likes @RunAs doesn't work with MDB Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » EJB and other Java EE Technologies
Bookmark "@RunAs doesn Watch "@RunAs doesn New topic
Author

@RunAs doesn't work with MDB

Stefan Müller
Greenhorn

Joined: Jun 25, 2008
Posts: 12
Hi,

I have a message drive bean which I annotated with @RunAs("SYSTEM"). In the onMessage method I'm checking now the subject like this:



and also like this:



Both of them are null.

1. I expected that due to the RunAs, I'd get some subject with a "SYSTEM" principal.
2. I don't understand what's the difference between the two pieces of code, getting the subject. In some other cases, one is null, the other isn't. Which one is the correct to use?
3. Is there a great book, explaining the security internals? Everything I found was rather sketchy, I need to know some more details about how things work togeter (loginmodule, interceptor, identities, principals) cause I need to implement some custom security features


Best regards,
Stefan
Jeanne Boyarsky
internet detective
Marshal

Joined: May 26, 2003
Posts: 29261
    
140

Stefan,
The second character of your last name displays as a "?" on my machine. Just curious - is it an ASCII character? If not, what language does it belong to?


[Blog] [JavaRanch FAQ] [How To Ask Questions The Smart Way] [Book Promos]
Blogging on Certs: SCEA Part 1, Part 2 & 3, Core Spring 3, OCAJP, OCPJP beta, TOGAF part 1 and part 2
Stefan Müller
Greenhorn

Joined: Jun 25, 2008
Posts: 12
Jeanne,

it's a german umlaut-U (Ü) which apparently is not displayed correctly here :-)



http://en.wikipedia.org/wiki/Germanic_umlaut
Jaikiran Pai
Marshal

Joined: Jul 20, 2005
Posts: 9327
    
110

I have a message drive bean which I annotated with @RunAs("SYSTEM"). In the onMessage method I'm checking now the subject ...



http://www.j2ee.me/javaee/5/docs/api/javax/ejb/EJBContext.html#getCallerPrincipal()


[My Blog] [JavaRanch Journal]
Jeanne Boyarsky
internet detective
Marshal

Joined: May 26, 2003
Posts: 29261
    
140

Stefan M�ller wrote:it's a german umlaut-U (Ü) which apparently is not displayed correctly here :-)

Thanks. I was not aware of that. It did work at one point. I see it in the release notes. And a thread in the moderators forum where some European moderators validated it. I'll add it to our bug list.
Stefan Müller
Greenhorn

Joined: Jun 25, 2008
Posts: 12


Results in Exception: No valid security context for the caller identity

The additional issue is, that I want to be able to read the Principal in an interceptor of a method which is called by the MDB.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: @RunAs doesn't work with MDB
 
Similar Threads
JAAS in Websphere
tomcat as service -> cannot start WINWORD.exe
Runtime.exec , application is invisible
weblogic 10 jaas and now what?
Book Promotion : Hacking Exposed: J2EE and Java