Using a secured EJB from a JAX-RS web service
问题 I'm running Glassfish 4 and Jersey as JAX-RS implementation. I have secured my EJB like this: @Stateless @DeclareRoles({"Authentication_Reader"}) @RolesAllowed({"Authentication_Reader"}) public class AuthenticationServiceBean { public void foo() { ... } } I have created a security-role-mapping entry in glassfish-web.xml, and I've also created a security-role declaration in web.xml. The following works from a servlet: @WebServlet(name = "TestServlet", urlPatterns = {"/test.do"}) @RunAs(