[jboss-user] [EJB 3.0 Development] - javax.ejb.EJBAccessException: Caller unauthorized when calling //EJB3 @Service from client code

Dave Bredesen do-not-reply at jboss.com
Thu Jun 3 15:34:36 EDT 2010


Dave Bredesen [http://community.jboss.org/people/dbredesen] created the discussion

"javax.ejb.EJBAccessException: Caller unauthorized when calling //EJB3 @Service from client code"

To view the discussion, visit: http://community.jboss.org/message/546116#546116

--------------------------------------------------------------
Hello,
I'm building an application on JBoss AS 5.1 and ICEFaces.  The application runs in a single JBoss instance currently.  I'm doing authentication via JAAS, using the DatabaseServerLoginModule, and I'm able to login successfully via ICEFaces as follows:

*         CallbackHandler cb = new Handler("someuser", password);
*
*     LoginContext lc = new LoginContext("foo", cb);
*
*     lc.login();*

Once logged in, I can see clearly that "someuser" has the "admin" role.  Now, I have an EJB set up as follows:

*     @Service
*
*     @Local
*
*     @SecurityDomain("foo") // corresponds to the security domain above
*
*     public class MyService implements MyServiceLocal {
*
*         @RolesAllowed("admin")
*
*         public void doSomething() {
*
*               // do something
*
*         }
*
*     }*


I am trying to call MyBean.doSomething() from my ICEFaces client code as follows:

*    InitialContext ctx = new InitialContext();
*
*    final String name = "MyService/local";
*
*         service =  (MyServiceLocal) ctx.lookup(name);
*
*         service.doSomething();  //* *causes EJBAccessException: Caller unauthorized*

Somehow, the callee doesn't recognize that I am authenticated.  I did a bit of debugging, and the caller thinks my principal is "anonymous".  

How do I get EJB to recognize my credentials which were established outside of EJB?  Do I need to pass some extra information to the InitialContext? (I tried setting Context.SECURITY_PRINCIPAL, with no luck...).  Any help would be appreciated!

Thanks,
Dave Bredesen

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

Reply to this message by going to Community
[http://community.jboss.org/message/546116#546116]

Start a new discussion in EJB 3.0 Development at Community
[http://community.jboss.org/choose-container!input.jspa?contentType=1&containerType=14&container=2030]

-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.jboss.org/pipermail/jboss-user/attachments/20100603/853d263d/attachment-0001.html 


More information about the jboss-user mailing list