[jboss-user] [JBoss Messaging] New message: "Principal Propagation and Messaging"
Michael Gerlinger
do-not-reply at jboss.com
Tue Mar 16 13:10:33 EDT 2010
User development,
A new message was posted in the thread "Principal Propagation and Messaging":
http://community.jboss.org/message/532329#532329
Author : Michael Gerlinger
Profile : http://community.jboss.org/people/m.gerlinger
Message:
--------------------------------------------------------------
Hello,
I've the following situation. In a WebApplication not deployed in jBoss we need remote acces to MessageDrivenBeans deployed in jBoss 5.1.0 GA. Deploying the MDB in jBoss and defining a Queue to call the MDB remote is not the problem. But we have the requirement, that the MDB must know the identity of its caller.
To call stateless EJBs we use the pricipal propagation from client to Server with a custom principal and our own LoginModul and it works fine.
Has anyone a idea how to get the same for calling a Message queue?
The following code doesn't work. It is just to point out how I would like o be able to code it :-)
In the Web Application:
//JAAS Login
[...]
LoginContext lc = new LoginContext("test", myCustomCallbackHandler);
lc.login();
// Do some Stuff
[...]
// call the queue
[...]
QueueConnection connect = factory.createQueueConnection();
QueueSession session = connect.createQueueSession(...);
Object lObject = ctx.lookup("/queue/myAppQueue");
Queue queue = (Queue) lObject;
QueueSender sender = session.createSender(queue);
TextMessage textMsg = session.createTextMessage();
textMsg.setText("abc");
sender.send(queue, textMsg);
In MDB:
@RolesAllowed(value={"admin"} )
public void onMessage(Message message) {
System.out.println("got message: " + message +
"from: "+SecurityAssociation.getCallerPrincipal());
}
and befor the queue I can use the propagated principal for authorization to write into the queue.
Is it possible to get an implementation as previously described? If yes pleas give me some hints how to get it.
If not: why? :-)
Thanks for answering
Michael
--------------------------------------------------------------
To reply to this message visit the message page: http://community.jboss.org/message/532329#532329
More information about the jboss-user
mailing list