users@jersey.java.net

[Jersey] How to call secured EJB from RestfulWebService?

From: Aruna Wagle <aruna.wagle_at_oracle.com>
Date: Thu, 4 Jul 2013 04:30:21 -0700 (PDT)

Our business logic is implemented using EJBs which are secured. User with particular role can access the EJB methods. I have created the Restful Webservice which calls this EJB. As of now the EJB lookup is done using JNDI. i.e. EJB is not injected in Webservice.

 

I am calling this Webservice using a client code like below:

 

Client client = Client.create();

client.addFilter(new HTTPBasicAuthFilter(.));

.

 

Inside my EJB if I call ejbContext. getCallerPrincipal(); I am getting value as ANONYMOUS.

 

How to resolve this issue?

 

 

Thanks