[jboss-user] [EJB 3.0] - SLSB @RunAs does not affect SessionContext.isCallerInRole

mnk@mnk.dk do-not-reply at jboss.com
Wed Dec 20 03:34:40 EST 2006


Hi all,

I have just upgraded to JBoss AS 4.0.5GA and I am experiencing some unexpected behavior. I have two SLSB converted from EJB 2.1 XDoclet beans to EJB3:

@Stateless
  | @Local(SomeLocal.class)
  | @RunAs(SomeBean.SOME_ROLE)
  | public class SomeBean implements SomeLocal {
  | 
  | 	static final String SOME_ROLE = "someRole";
  | 
  | 	@EJB
  | 	OtherLocal otherLocal;
  | 
  | 	public boolean test() {
  | 		return otherLocal.test();
  | 	}
  | 
  | }

and

@Stateless
  | @Local(OtherLocal.class)
  | public class OtherBean implements OtherLocal {
  | 
  | 	@Resource
  | 	SessionContext context;
  | 
  | 	@RolesAllowed(SomeBean.SOME_ROLE)
  | 	public boolean test() {
  | 		return context.isCallerInRole(SomeBean.SOME_ROLE);
  | 	}
  | 
  | }

I would expect that SomeLocal.test() would return true, as is the case with EJB 2.1 and JBoss 4.0.2, but instead the method returns false.

Do anyone know if this a bug in JBoss 4.0.5, or if it is working according to the spec.? As I read the spec. I think that it is a bug, but I would like a second opinion.

Regards
Mathias

View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=3995231#3995231

Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=3995231



More information about the jboss-user mailing list