aspose file tools*
The moose likes JBoss/WildFly and the fly likes Call from MDB to SSB is always anonymous in JBoss AS7/EAP6 Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Products » JBoss/WildFly
Bookmark "Call from MDB to SSB is always anonymous in JBoss AS7/EAP6" Watch "Call from MDB to SSB is always anonymous in JBoss AS7/EAP6" New topic
Author

Call from MDB to SSB is always anonymous in JBoss AS7/EAP6

Qu Vad
Greenhorn

Joined: Jul 14, 2013
Posts: 7
Got problem with JBoss AS7 / EAP6. In MDB, when I lookup for SSB and call its method, the call is always anonymous, i.e. sessionContext.getCallerPrincipal() returns Principal(anonymous). Always... In AS5 everything was fine.

How can I fix it to make a call with an authenticated user?

My MDB:

My queue settings:

My Security Domain:
Jaikiran Pai
Marshal

Joined: Jul 20, 2005
Posts: 10264
    
168

MDB don't have a client and hence don't run in a specific security context. If you want to invoke the SLSB from the MDB, in a security context, you can use the @RunAs annotation on the MDB and specify the role that you want to run as.

[My Blog] [JavaRanch Journal]
Qu Vad
Greenhorn

Joined: Jul 14, 2013
Posts: 7
Jaikiran Pai, thanks for the quick answer!

I receive a username in Message object in MDB. And I would like to call SSB by that user... Is there a way to create a security context for particular user in MDB.onMessage()?
Jaikiran Pai
Marshal

Joined: Jul 20, 2005
Posts: 10264
    
168

It's answered here https://community.jboss.org/message/827894#827894. Instead of the deployment descriptor, you can even use JBoss specific @org.jboss.ejb3.annotation.RunAsPrincipal annotation to specify a principal to be used when you do an outgoing EJB invocation from a MDB.

Qu Vad
Greenhorn

Joined: Jul 14, 2013
Posts: 7
Thanks for assistance! Solved by doing JAAS login in MDB.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Call from MDB to SSB is always anonymous in JBoss AS7/EAP6