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]

_______________________________________________
jboss-user mailing list
jboss-user@lists.jboss.org
https://lists.jboss.org/mailman/listinfo/jboss-user

Reply via email to