GlassFish ProgrammaticLogin does work across VMs (i.e.) when the EJb
and the client are on different VMs.
Also, it has to be ensured that the Ejb contains the <as-context> with
the realm name specified in the glassfish-ejb-jar.xml. This realm name
should also be specified in the ProgrammaticLogin call.
Thanks
Nithya
On Thursday 04 August 2011 02:03 AM, Laird Nelson wrote:
> I'm looking for the official way to authenticate (in this case from an
> integration test) against a Glassfish container so that I can simply
> look up an EJB reference.
>
> I seem to recall that way back when JBoss allowed you (incorrectly, or
> at least hackishly) to pass a username and password into the JNDI
> InitialContext, and then used these values to authenticate you against
> the container. Although to my way of reading things this was abusing
> the JNDI specification a little bit, it worked.
>
> I am aware of the HttpServletRequest#login() method, which of course
> will do me no good, and I'm also dimly aware of the Glassfish
> ProgrammaticLogin class, which--it would seem--wouldn't do me any good
> either, since I'm in a different VM from the server. Or maybe one of
> those is (somehow) the way to go here?
>
> Thanks,
> Laird