3 Replies Latest reply on Aug 4, 2003 10:44 AM by Dave Roxburgh

    How do I determine if caller has role within EJB?

    Dave Roxburgh Newbie

      I'm trying to use EntityContext.isCallerInRole() in an EJB... but it doesn't work.

      JBoss 3.0.4

      When isCallerInRole() is called I get the following output to server.log:
      2003-07-18 16:51:49,456 ERROR [org.jboss.ejb.plugins.LogInterceptor] RuntimeException:
      java.lang.IllegalStateException: isCallerInRole() called with no security context. Check that a security-domain has been set for the application.
      at org.jboss.ejb.EnterpriseContext$EJBContextImpl.isCallerInRole(EnterpriseContext.java:389)

      Can some really clever person tell me
      how to set up whatever it is that's missing? Of course, I have set up an application-policy in login-conf.xml (a DatabaseServerLoginModule) and all the role-based access control is working just fine for JSP access.
      tell me I'm doing it all wrong... and the right way to do it - I'm just trying to find out if the calling principal has been allocated a specific role... it shouldn't be difficult, should it???

      Many thanks,