-
1. Re: @RunAs in JBoss 5 - Caller unauthorized in second call
komet_1978 May 27, 2009 5:55 AM (in response to komet_1978)This is the corresponding stack trace:
ERROR [STDERR] javax.ejb.EJBAccessException: Caller unauthorized ERROR [STDERR] at org.jboss.ejb3.security.RoleBasedAuthorizationInterceptorv2.invoke(RoleBasedAuthorizationInterceptorv2.java:199) ERROR [STDERR] at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:102) ERROR [STDERR] at org.jboss.ejb3.security.Ejb3AuthenticationInterceptorv2.invoke(Ejb3AuthenticationInterceptorv2.java:186) ERROR [STDERR] at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:102) ERROR [STDERR] at org.jboss.ejb3.ENCPropagationInterceptor.invoke(ENCPropagationInterceptor.java:41) ERROR [STDERR] at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:102) ERROR [STDERR] at org.jboss.ejb3.asynchronous.AsynchronousInterceptor.invoke(AsynchronousInterceptor.java:106) ERROR [STDERR] at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:102) ERROR [STDERR] at org.jboss.ejb3.BlockContainerShutdownInterceptor.invoke(BlockContainerShutdownInterceptor.java:67) ERROR [STDERR] at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:102) ERROR [STDERR] at org.jboss.aspects.currentinvocation.CurrentInvocationInterceptor.invoke(CurrentInvocationInterceptor.java:67) ERROR [STDERR] at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:102) ERROR [STDERR] at org.jboss.ejb3.stateless.StatelessContainer.dynamicInvoke(StatelessContainer.java:487) ERROR [STDERR] at org.jboss.ejb3.remoting.IsLocalInterceptor.invokeLocal(IsLocalInterceptor.java:85) ERROR [STDERR] at org.jboss.ejb3.remoting.IsLocalInterceptor.invoke(IsLocalInterceptor.java:72) ERROR [STDERR] at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:102) ERROR [STDERR] at org.jboss.aspects.remoting.PojiProxy.invoke(PojiProxy.java:62)
-
2. Re: @RunAs in JBoss 5 - Caller unauthorized in second call
lvonk2000 Oct 2, 2009 10:10 AM (in response to komet_1978)We are experiencing the same thing. Have you found an answer?
-
3. Re: @RunAs in JBoss 5 - Caller unauthorized in second call
praenti Oct 13, 2009 4:33 AM (in response to komet_1978)Seeing same behaviour in an implementation. Looks like a bug in JBoss5, bacause I cannot see the idea behind this behaviour. Can anyone do a bug report?
Regards,
Michael -
4. Re: @RunAs in JBoss 5 - Caller unauthorized in second call
akolmakov Nov 2, 2009 4:35 AM (in response to komet_1978) -
5. Re: @RunAs in JBoss 5 - Caller unauthorized in second call
komet_1978 Nov 2, 2009 4:42 AM (in response to komet_1978)"lvonk2000" wrote:
We are experiencing the same thing. Have you found an answer?
No, my work around is to propagate a second level call to a local unsecured EJB. -
6. Re: @RunAs in JBoss 5 - Caller unauthorized in second call
akolmakov Nov 2, 2009 5:00 AM (in response to komet_1978)Created issue https://jira.jboss.org/jira/browse/EJBTHREE-1945
-
7. Re: @RunAs in JBoss 5 - Caller unauthorized in second call
wolfc Jul 1, 2010 8:54 AM (in response to komet_1978)I've added a test in the EJB 3 testsuite, see http://anonsvn.jboss.org/repos/jbossas/projects/ejb3/trunk/testsuite/src/test/java/org/jboss/ejb3/test/ejbthree1945/. It passes against AS trunk. Please take a look at the code and see if I've got the test correctly coded.
-
8. Re: @RunAs in JBoss 5 - Caller unauthorized in second call
pappy Oct 11, 2010 11:05 AM (in response to wolfc)Hi Carlo
I have attached an archive to https://jira.jboss.org/browse/EJBTHREE-1945, which contains an small example of this kind of failure...
Please note that I haven't use any JBoss specific @annotation, however, even if I use them the error still persists
-
9. @RunAs in JBoss 5 - Caller unauthorized in second call
gauravag Jan 21, 2011 1:14 AM (in response to komet_1978)Hi Thomas,
Point what you are talking about is true. Its a sort of bug i think.
For this u need to add in ur login-config.xml file (where u have specified ur authentication policy ) along with ClientLoginModule.
This whole application can be seen in here on this link
http://community.jboss.org/message/555342#555342
Also u can see the security faq in jboss community on this link ofr some details
http://community.jboss.org/wiki/SecurityFAQ
Regards,
-
10. @RunAs in JBoss 5 - Caller unauthorized in second call
dlofthouse Jan 21, 2011 5:09 AM (in response to gauravag)The ClientLoginModule should not be added to the same policy as is used to secure the actual application, doing so can cause unexpected results especially where a RunAs identity is involved.
-
11. Re: @RunAs in JBoss 5 - Caller unauthorized in second call
grossetieg Apr 2, 2011 4:50 AM (in response to komet_1978)Hi,
I found an explanation in Ejb3AuthenticationInterceptorv2 (jboss-ejb3-core 1.1.5). First call, when the security context is populated the "to" IncomingRunAs is set with the "from" OutgoingRunAs :
private void populateSecurityContext(SecurityContext to, SecurityContext from) { SecurityActions.setSubjectInfo(to, from.getSubjectInfo()); SecurityActions.setIncomingRunAs(to, from.getOutgoingRunAs()); }
Second call the "from" OutgoingRunAs is now empty or null and the "to" IncomingRunAs is set to empty or null. The caller is not anymore trusted :
boolean trustedCaller = (hasIncomingRunAsIdentity(sc)) || (helper.isTrusted());
The following exception is thrown :
throw new EJBAccessException("Invalid User");
My work around is to populate the "to" SecurityContext with either the "from" OutgoingRunAs or the "from" IncomingRunAs.
I use the following code to set my "run-as" identity :
securityContext.setOutgoingRunAs(runAs)
(I was using SecurityAssociation.pushRunAsIdentity() but I think there's a memory leak because the pop() is never call on the threadRunAsStacks).
Then I call my bean annotated with @SecurityDomain(value="A") which call a second bean annotated with @SecurityDomain(value="A") which call a third bean annotated with @SecurityDomain(value="C") which....
Without my work around I can only call the first bean... then when the second bean is called an EJBAccessException is thrown.
I'm not sure this is the right way to fix the propagation issue but it's working
Guillaume.
-
12. Re: @RunAs in JBoss 5 - Caller unauthorized in second call
grossetieg Apr 3, 2011 12:28 PM (in response to wolfc)Carlo de Wolf a écrit:
I've added a test in the EJB 3 testsuite, see http://anonsvn.jboss.org/repos/jbossas/projects/ejb3/trunk/testsuite/src/test/java/org/jboss/ejb3/test/ejbthree1945/. It passes against AS trunk. Please take a look at the code and see if I've got the test correctly coded.
I may be wrong but in your test Caller and CallerWithIdentity use StatelessBBean instead of StatelessABean.
Guillaume.
-
13. Re: @RunAs in JBoss 5 - Caller unauthorized in second call
johan.hedin Jun 15, 2011 10:04 AM (in response to komet_1978)We have the same problem porting from JBoss 4.2.3 to JBoss 5.1.0. I agree that the test needs to use StatelessABean to test the propagation.