users@glassfish.java.net

Re: How do logon or set principle/roles/groups when using Embedded API

From: <glassfish_at_javadesktop.org>
Date: Tue, 30 Mar 2010 12:28:11 PDT

Hi Everybody,
I am using a little different solution for testing secured ejbs with embedded glassfish. I have domain.xml in src/test/java/org/glassfish/embed with custom data source as I learned from this website: http://blog.blackbit.be/?p=5 To tests ejbs with @RolesAllowed restriction I created (with standalone glassfish) test user and groups named after roles within the file realm and copy the keyfile into src/test/java/config. Everything works fine just with this initialization:

container = EJBContainer.createEJBContainer();
context = container.getContext();
ProgrammaticLogin pl = new ProgrammaticLogin();
pl.login("user", "", "file", true);

Is that approach all right? Thank you.
[Message sent by forum member 'stan_svec']

http://forums.java.net/jive/thread.jspa?messageID=394538