users@glassfish.java.net

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

From: <glassfish_at_javadesktop.org>
Date: Wed, 18 Apr 2007 14:12:38 PDT

Hi,

can anybody give me some help how to establish a remote ejb connection with a specific User Principal? We whant to do this inside a JUnit Test.

Normaly I can get the reference to my session ejb with a code like this

        InitialContext ic = new InitialContext();
        wipm = (MyEJB) ic.lookup(org.imixs.MyEJB.class.getName());

this works well for a simple JUnit test.
Now we whant to esteblish a authenticated Connection.

We try something like this:


    Properties props = new Properties();
    props.setProperty(InitialContext.SECURITY_PRINCIPAL, "tom");
    props.setProperty(InitialContext.SECURITY_CREDENTIALS, "tom");
        InitialContext ic = new InitialContext(props);
    wipm = (MyEJB) ic.lookup(org.imixs.MyEJB.class.getName());


but this seems not to work.

Can anyone give me a short example how to create a ejb inside a JUnit Test with a specific Prinicipal and Password.

Thanks for your help
Ralph
[Message sent by forum member 'rsoika' (rsoika)]

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