-
1. Re: Setting up a Caller Principal in an Arquillian test
aslak Aug 10, 2010 12:35 PM (in response to woelfle)Arquillian currently has no built in helper support for ejb security, even tho it's on our list.
But ALR has some code testing ejb security in his upcoming EJB3 Book using Arquillian.
http://community.jboss.org/wiki/Chapter15-SecurityandSchoolEJBAccess
Basically do a manual login using a new InitialContext() and set SECURITY_PRINCIPAL and SECURITY_CREDENTIALS. Then use that Context to lookup your EJBs.
If your interested in helping prototyping some secure context integration for Arquillian please let me know..
-
2. Re: Setting up a Caller Principal in an Arquillian test
dan.j.allen Aug 11, 2010 1:55 PM (in response to aslak)This would make a good FAQ.
-
3. Re: Setting up a Caller Principal in an Arquillian test
meindert.hoving Jun 2, 2017 7:57 AM (in response to woelfle)to set the context I add @OverProtocol("Servlet 3.0") to the @Deployment
to set the 'CallerPrincipal' I use the following code in my Arquilian test:
@EJB private MDocumentListController mDocumentListController;
@Before
public void init() throws NamingException {
SecurityClient client;
try {
client = SecurityClientFactory.getSecurityClient();
client.setSimple("[username]", "[password]");
try {
client.login();
} catch (LoginException e) {
e.printStackTrace();
}
} catch (Exception e1) {
e1.printStackTrace();
}