users@glassfish.java.net

Re: How to create a ejb reference from client with Security Credentials?

From: <glassfish_at_javadesktop.org>
Date: Wed, 18 Apr 2007 23:03:01 PDT

Hi Ralph,

To my knowledge GlassFish doesn't support InitialContext Principal/Credential Information. You will have to use the class ProgrammaticLogin instead. See http://docs.sun.com/app/docs/doc/819-3672/6n5sj2siu?a=view for docs.

This class can be used to create Security Tokens in standalone clients as well as with web apps. So your code has to change to:

ProgrammaticLogin pl = new ProgrammaticLogin();
InitialContext ic = new InitialContext();
pl.login("user","passwd"):
wipm = (MyEJB) ic.lookup(org.imixs.MyEJB.class.getName());

The prinical is then matched (if not otherwise specified) against the default realm of GlassFish (=File Realm).

Hope this helps
Daniel
[Message sent by forum member 'barz26' (barz26)]

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