Re: [jboss-user] [EJB 3.0] - Security principal propagation accross ejb3 modules
by Davide Tabarelli
Davide Tabarelli [http://community.jboss.org/people/giantPM] replied to the discussion
"Security principal propagation accross ejb3 modules"
To view the discussion, visit: http://community.jboss.org/message/544697#544697
--------------------------------------------------------------
No one is answering me ... maybe my question is too newbie/stupid or ill-posed ??
I suppose the last (ill-posed) and therefore I try to explain it again better.
As far as I know, credential/principal has to be propagated within ejb modules in the same JVM/JBoss instance, but it seems this doesn't happen in my system (JBoss 5.1.0 GA).
The situation:
- Two EJB modules in an EAR. Same security realm.
- A client (web or standalone ... doesn't matter) calls a method A inside a session bean in EJB A.
- The client is authenticated as Principal="SomeOne", Role="MyRole".
- The method requires role "MyRole" by means of @RolesAllowed("MyRole")
- The method A in turns calls a method B, that is inside another session bean in EJB B.
- Also the method B is marked with @RolesAllowed("MyRole").
- Resulting exception: "javax.ejb.EJBAccessException: Caller unauthorized"
Looking into the logs (TRACE level) it points out that:
1) The call to the method A is succerssfully authenticated (Principal="SomeOne", Role="MyRole").
2) The principal/credentials get lost in the subsequent call to method B (Principal=anonymous).
Someone faced this issue before?
Thanking you in advance.
D.
--------------------------------------------------------------
Reply to this message by going to Community
[http://community.jboss.org/message/544697#544697]
Start a new discussion in EJB 3.0 at Community
[http://community.jboss.org/choose-container!input.jspa?contentType=1&cont...]
14 years, 7 months
[JNDI and Naming] - problems with JNDI in AS 6 M3
by marc torrent
marc torrent [http://community.jboss.org/people/rameau1982] created the discussion
"problems with JNDI in AS 6 M3"
To view the discussion, visit: http://community.jboss.org/message/544687#544687
--------------------------------------------------------------
Hello,
I'm facing a problem with JNDI and JBoss. I've developed a webapp for tomcat6, that, among other things, uses JNDI to put messages in an activeMQ queue. To configure JNDI with tomcat I put inside META-INF/context.xml:
<?xml version="1.0" encoding="UTF-8"?>
<Context antiJARLocking="true" path="/TranscodingGateway" docBase="TranscodingGateway" debug="0" reloadable="true">
<Resource
name="jms/ConnectionFactory"
auth="Container"
type="org.apache.activemq.ActiveMQConnectionFactory"
description="JMS Connection Factory"
factory="org.apache.activemq.jndi.JNDIReferenceFactory"
brokerURL="tcp://localhost:61616"
brokerName="localhost"
usejmx="false"
useDatabaseLock="false"
useEmbeddedBroker="false" />
<Resource
name="jms/Transcoding"
auth="Container"
type="org.apache.activemq.command.ActiveMQQueue"
factory="org.apache.activemq.jndi.JNDIReferenceFactory"
physicalName="Transcoding" />
</Context>
and nothing extra in web.xml
Also, the java code is like:
......................
InitialContext ic = new InitialContext();
Context ctx = (Context) ic.lookup("java:comp/env");
ConnectionFactory cf = (ConnectionFactory)
ctx.lookup("jms/ConnectionFactory");
Connection conn = (Connection) cf.createConnection();
conn.start();
Session s = conn.createSession(false,Session.CLIENT_ACKNOWLEDGE);
Destination d = (Destination) ctx.lookup("jms/Transcoding");
MessageProducer mp = s.createProducer(d);
mp.setDeliveryMode(DeliveryMode.PERSISTENT);
..........................
With this configuration works fine with tomcat standalone, but not in JBoss. The deployer doesn't say any error, but when executing the code it fails at line: ctx.lookup("jms/ConnectionFactory");
the log: http://pastebin.com/1rmVTWz3 http://pastebin.com/1rmVTWz3
If I make a change inside web.xml and add:
<resource-env-ref>
<description>
ActiveMQ ConnectionFactory
</description>
<resource-env-ref-name>
jms/ConnectionFactory
</resource-env-ref-name>
<resource-env-ref-type>
org.apache.activemq.ActiveMQConnectionFactory
</resource-env-ref-type>
</resource-env-ref>
<resource-env-ref>
<description>
ActiveMQ Queue
</description>
<resource-env-ref-name>
jms/Transcoding
</resource-env-ref-name>
<resource-env-ref-type>
org.apache.activemq.command.ActiveMQQueue
</resource-env-ref-type>
</resource-env-ref>
I get the following error at deployment:
http://pastebin.com/YyNqWa4b http://pastebin.com/YyNqWa4b
Any ideas? As I've read, context look up can be done inside context.xml of the application. What I'm doing wrong, or what am I missing to do?
thank's!
--------------------------------------------------------------
Reply to this message by going to Community
[http://community.jboss.org/message/544687#544687]
Start a new discussion in JNDI and Naming at Community
[http://community.jboss.org/choose-container!input.jspa?contentType=1&cont...]
14 years, 7 months