I'm trying ti use @RunAs("") annotation so as i can call a secured ejb from other one (TestEJBBean)
I've created an ejb and add this
@DeclareRoles("user")
@Stateless
@RunAs("user")
public class TestEJBBean implements ITestBean {
...
}
but i'm getting an exception The RunAs role "user" is not mapped to a principal. I tried to set the web.xml via setWebXML in my deployment method but it didnt work (i got another exception ).
(I'm running my tests under an embedded glassfish)
Any ideas !!
The problem was solved by definnig security-role-mapping in sun-web.xml and adding it in the deployment addAsWebInfResource("WEB-INF/sun-web.xml")