Bugs item #654652, was opened at 2002-12-16 07:41
You can respond by visiting: 
https://sourceforge.net/tracker/?func=detail&atid=376685&aid=654652&group_id=22866

Category: JBossSX
Group: v3.0 Rabbit Hole
>Status: Closed
>Resolution: Remind
Priority: 5
Submitted By: Maxim (kimerinn)
>Assigned to: Scott M Stark (starksm)
Summary: Message-driven bean security error

Initial Comment:
Scenario:

1) I created a secured session bean, it can be accessed
under the <tester> security role. 
2) I created a message-driven bean, which operates
under <run-as> identity and has <tester> sequrity role.
3) When MDB tries to access secured session bean, an
error raises:

17:21:21,015 ERROR [LogInterceptor] EJBException, causedBy:

java.lang.SecurityException: Authentication exception,
principal=null

        at
org.jboss.ejb.plugins.SecurityInterceptor.checkSecurityAssociation(SecurityInterceptor.java:173)

        at
org.jboss.ejb.plugins.SecurityInterceptor.invokeHome(SecurityInterceptor.java:94)

        at
org.jboss.ejb.plugins.LogInterceptor.invokeHome(LogInterceptor.java:129)

        at
org.jboss.ejb.StatelessSessionContainer.invokeHome(StatelessSessionContainer.java:300)

        at
org.jboss.ejb.plugins.local.BaseLocalContainerInvoker.invokeHome(BaseLocalContainerInvoker.java:230)

        at
org.jboss.ejb.plugins.local.LocalHomeProxy.invoke(LocalHomeProxy.java:110)

        at $Proxy25.create(Unknown Source)

        at ejbtest.mdbBean.onMessage(mdbBean.java:27)

        at java.lang.reflect.Method.invoke(Native Method)

        at
org.jboss.ejb.MessageDrivenContainer$ContainerInterceptor.invoke(MessageDrivenContainer.java:391)

        at
org.jboss.resource.connectionmanager.CachedConnectionInterceptor.invoke(CachedConnectionInterceptor.java:186)

        at
org.jboss.ejb.plugins.AbstractTxInterceptor.invokeNext(AbstractTxInterceptor.java:107)

        at
org.jboss.ejb.plugins.AbstractTxInterceptorBMT.invokeNext(AbstractTxInterceptorBMT.java:144)

        at
org.jboss.ejb.plugins.MessageDrivenTxInterceptorBMT.invoke(MessageDrivenTxInterceptorBMT.java:33)

        at
org.jboss.ejb.plugins.MessageDrivenInstanceInterceptor.invoke(MessageDrivenInstanceInterceptor.java:88)

        at
org.jboss.ejb.plugins.RunAsSecurityInterceptor.invoke(RunAsSecurityInterceptor.java:100)

        at
org.jboss.ejb.plugins.LogInterceptor.invoke(LogInterceptor.java:203)

        at
org.jboss.ejb.MessageDrivenContainer.invoke(MessageDrivenContainer.java:302)

        at
org.jboss.ejb.plugins.jms.JMSContainerInvoker.invoke(JMSContainerInvoker.java:962)

        at
org.jboss.ejb.plugins.jms.JMSContainerInvoker$MessageListenerImpl.onMessage(JMSContainerInvoker.java:1038)

        at
org.jboss.jms.asf.StdServerSession.onMessage(StdServerSession.java:238)

        at
org.jboss.mq.SpyMessageConsumer.sessionConsumerProcessMessage(SpyMessageConsumer.java:603)

        at
org.jboss.mq.SpyMessageConsumer.addMessage(SpyMessageConsumer.java:417)

        at org.jboss.mq.SpySession.run(SpySession.java:259)

        at
org.jboss.jms.asf.StdServerSession.run(StdServerSession.java:177)

        at
EDU.oswego.cs.dl.util.concurrent.PooledExecutor$Worker.run(PooledExecutor.java:642)

        at java.lang.Thread.run(Thread.java:484)

17:21:21,065 ERROR [STDERR] javax.ejb.EJBException:
checkSecurityAssociation; CausedByException is:
        Authentication exception, principal=null

17:21:21,065 ERROR [STDERR]     at
org.jboss.ejb.plugins.SecurityInterceptor.checkSecurityAssociation(SecurityInterceptor.java:174)

17:21:21,706 ERROR [STDERR]     at
org.jboss.ejb.plugins.SecurityInterceptor.invokeHome(SecurityInterceptor.java:94)

17:21:21,706 ERROR [STDERR]     at
org.jboss.ejb.plugins.LogInterceptor.invokeHome(LogInterceptor.java:129)

17:21:21,706 ERROR [STDERR]     at
org.jboss.ejb.StatelessSessionContainer.invokeHome(StatelessSessionContainer.java:300)

17:21:21,706 ERROR [STDERR]     at
org.jboss.ejb.plugins.local.BaseLocalContainerInvoker.invokeHome(BaseLocalContainerInvoker.java:230)

17:21:21,716 ERROR [STDERR]     at
org.jboss.ejb.plugins.local.LocalHomeProxy.invoke(LocalHomeProxy.java:110)

17:21:21,716 ERROR [STDERR]     at $Proxy25.create(Unknown
Source)

17:21:21,716 ERROR [STDERR]     at
ejbtest.mdbBean.onMessage(mdbBean.java:27)

17:21:21,716 ERROR [STDERR]     at
java.lang.reflect.Method.invoke(Native Method)

17:21:21,716 ERROR [STDERR]     at
org.jboss.ejb.MessageDrivenContainer$ContainerInterceptor.invoke(MessageDrivenContainer.java:391)

17:21:21,716 ERROR [STDERR]     at
org.jboss.resource.connectionmanager.CachedConnectionInterceptor.invoke(CachedConnectionInterceptor.java:186)

17:21:21,726 ERROR [STDERR]     at
org.jboss.ejb.plugins.AbstractTxInterceptor.invokeNext(AbstractTxInterceptor.java:107)

17:21:21,746 ERROR [STDERR]     at
org.jboss.ejb.plugins.AbstractTxInterceptorBMT.invokeNext(AbstractTxInterceptorBMT.java:144)

17:21:21,746 ERROR [STDERR]     at
org.jboss.ejb.plugins.MessageDrivenTxInterceptorBMT.invoke(MessageDrivenTxInterceptorBMT.java:33)

17:21:21,746 ERROR [STDERR]     at
org.jboss.ejb.plugins.MessageDrivenInstanceInterceptor.invoke(MessageDrivenInstanceInterceptor.java:88)

17:21:21,746 ERROR [STDERR]     at
org.jboss.ejb.plugins.RunAsSecurityInterceptor.invoke(RunAsSecurityInterceptor.java:100)

17:21:21,756 ERROR [STDERR]     at
org.jboss.ejb.plugins.LogInterceptor.invoke(LogInterceptor.java:203)

17:21:21,756 ERROR [STDERR]     at
org.jboss.ejb.MessageDrivenContainer.invoke(MessageDrivenContainer.java:302)

17:21:21,756 ERROR [STDERR]     at
org.jboss.ejb.plugins.jms.JMSContainerInvoker.invoke(JMSContainerInvoker.java:962)

17:21:21,756 ERROR [STDERR]     at
org.jboss.ejb.plugins.jms.JMSContainerInvoker$MessageListenerImpl.onMessage(JMSContainerInvoker.java:1038)

17:21:22,046 ERROR [STDERR]     at
org.jboss.jms.asf.StdServerSession.onMessage(StdServerSession.java:238)

17:21:22,046 ERROR [STDERR]     at
org.jboss.mq.SpyMessageConsumer.sessionConsumerProcessMessage(SpyMessageConsumer.java:603)

17:21:22,046 ERROR [STDERR]     at
org.jboss.mq.SpyMessageConsumer.addMessage(SpyMessageConsumer.java:417)

17:21:22,046 ERROR [STDERR]     at
org.jboss.mq.SpySession.run(SpySession.java:259)

17:21:22,046 ERROR [STDERR]     at
org.jboss.jms.asf.StdServerSession.run(StdServerSession.java:177)

17:21:22,056 ERROR [STDERR]     at
EDU.oswego.cs.dl.util.concurrent.PooledExecutor$Worker.run(PooledExecutor.java:642)

17:21:22,066 ERROR [STDERR]     at
java.lang.Thread.run(Thread.java:484)

17:21:22,066 ERROR [STDERR]
java.lang.SecurityException: Authentication exception,
principal=null

17:21:22,066 ERROR [STDERR]     at
org.jboss.ejb.plugins.SecurityInterceptor.checkSecurityAssociation(SecurityInterceptor.java:173)

17:21:22,066 ERROR [STDERR]     at
org.jboss.ejb.plugins.SecurityInterceptor.invokeHome(SecurityInterceptor.java:94)

17:21:22,246 ERROR [STDERR]     at
org.jboss.ejb.plugins.LogInterceptor.invokeHome(LogInterceptor.java:129)

17:21:22,246 ERROR [STDERR]     at
org.jboss.ejb.StatelessSessionContainer.invokeHome(StatelessSessionContainer.java:300)

17:21:22,246 ERROR [STDERR]     at
org.jboss.ejb.plugins.local.BaseLocalContainerInvoker.invokeHome(BaseLocalContainerInvoker.java:230)

17:21:22,246 ERROR [STDERR]     at
org.jboss.ejb.plugins.local.LocalHomeProxy.invoke(LocalHomeProxy.java:110)

17:21:22,257 ERROR [STDERR]     at $Proxy25.create(Unknown
Source)

17:21:22,257 ERROR [STDERR]     at
ejbtest.mdbBean.onMessage(mdbBean.java:27)

17:21:22,257 ERROR [STDERR]     at
java.lang.reflect.Method.invoke(Native Method)

17:21:22,457 ERROR [STDERR]     at
org.jboss.ejb.MessageDrivenContainer$ContainerInterceptor.invoke(MessageDrivenContainer.java:391)

17:21:22,467 ERROR [STDERR]     at
org.jboss.resource.connectionmanager.CachedConnectionInterceptor.invoke(CachedConnectionInterceptor.java:186)

17:21:22,527 ERROR [STDERR]     at
org.jboss.ejb.plugins.AbstractTxInterceptor.invokeNext(AbstractTxInterceptor.java:107)

17:21:22,527 ERROR [STDERR]     at
org.jboss.ejb.plugins.AbstractTxInterceptorBMT.invokeNext(AbstractTxInterceptorBMT.java:144)

17:21:22,527 ERROR [STDERR]     at
org.jboss.ejb.plugins.MessageDrivenTxInterceptorBMT.invoke(MessageDrivenTxInterceptorBMT.java:33)

17:21:22,547 ERROR [STDERR]     at
org.jboss.ejb.plugins.MessageDrivenInstanceInterceptor.invoke(MessageDrivenInstanceInterceptor.java:88)

17:21:22,547 ERROR [STDERR]     at
org.jboss.ejb.plugins.RunAsSecurityInterceptor.invoke(RunAsSecurityInterceptor.java:100)

17:21:22,547 ERROR [STDERR]     at
org.jboss.ejb.plugins.LogInterceptor.invoke(LogInterceptor.java:203)

17:21:22,547 ERROR [STDERR]     at
org.jboss.ejb.MessageDrivenContainer.invoke(MessageDrivenContainer.java:302)

17:21:22,557 ERROR [STDERR]     at
org.jboss.ejb.plugins.jms.JMSContainerInvoker.invoke(JMSContainerInvoker.java:962)

17:21:22,557 ERROR [STDERR]     at
org.jboss.ejb.plugins.jms.JMSContainerInvoker$MessageListenerImpl.onMessage(JMSContainerInvoker.java:1038)

17:21:22,557 ERROR [STDERR]     at
org.jboss.jms.asf.StdServerSession.onMessage(StdServerSession.java:238)

17:21:22,557 ERROR [STDERR]     at
org.jboss.mq.SpyMessageConsumer.sessionConsumerProcessMessage(SpyMessageConsumer.java:603)

17:21:22,557 ERROR [STDERR]     at
org.jboss.mq.SpyMessageConsumer.addMessage(SpyMessageConsumer.java:417)

17:21:22,557 ERROR [STDERR]     at
org.jboss.mq.SpySession.run(SpySession.java:259)

17:21:22,567 ERROR [STDERR]     at
org.jboss.jms.asf.StdServerSession.run(StdServerSession.java:177)

17:21:22,567 ERROR [STDERR]     at
EDU.oswego.cs.dl.util.concurrent.PooledExecutor$Worker.run(PooledExecutor.java:642)

17:21:22,567 ERROR [STDERR]     at
java.lang.Thread.run(Thread.java:484)


=========================================
I have created a simple demo and attached it to post.
Unzip archive and copy files from
"errorDemo\JBoss_build" into appropriate JBoss
directories.  Start JBoss. Edit paths in file
"errorDemo\client_build\startClient.bat" and start it.
You will get an error in JBoss log after several seconds.

----------------------------------------------------------------------

>Comment By: Scott M Stark (starksm)
Date: 2002-12-16 13:25

Message:
Logged In: YES 
user_id=175228

The run-as role does not assign a principal to the mdb 
thread. You have to configure the security domain to allow 
anonymous callers since there is no security context coming 
from the JMS message. The dbtest login module 
configuration would have to add the unauthenticatedIdentity 
to assign the principal given to anonymous users as shown 
here:

<application-policy name = "dbtest">
 <authentication>
  <login-module code 
= "org.jboss.security.auth.spi.DatabaseServerLoginModule" 
flag = "required">
   <module-option name 
= "dsJndiName">java:/DefaultDS</module-option>
   <module-option name = "principalsQuery">select 
Password from Principals where PrincipalID=?</module-
option>
   <module-option name = "rolesQuery">select Role, 
RoleGroup from Roles where PrincipalID=?</module-option>
   <module-option name 
= "unauthenticatedIdentity">guest</module-option>
  </login-module>
 </authentication>
</application-policy>


----------------------------------------------------------------------

Comment By: Maxim (kimerinn)
Date: 2002-12-16 07:48

Message:
Logged In: YES 
user_id=500469

Addition: 
I am using Win2000 professional, JDK 1.4.1 & JBoss 3.0.4

And here is updated demo file (with SRC\META-INF directory)

----------------------------------------------------------------------

You can respond by visiting: 
https://sourceforge.net/tracker/?func=detail&atid=376685&aid=654652&group_id=22866


-------------------------------------------------------
This sf.net email is sponsored by:
With Great Power, Comes Great Responsibility 
Learn to use your power at OSDN's High Performance Computing Channel
http://hpc.devchannel.org/
_______________________________________________
Jboss-development mailing list
[EMAIL PROTECTED]
https://lists.sourceforge.net/lists/listinfo/jboss-development

Reply via email to