Hi, all part of my testing :-)

Well, I've updated the code.
exposing @remote and @local

Using remote:
 props.put("java.naming.security.principal", "admin");
 props.put("java.naming.security.credentials", "admin");
 props.put(Context.INITIAL_CONTEXT_FACTORY,
"org.apache.openejb.client.RemoteInitialContextFactory");
 props.put(Context.PROVIDER_URL, "http://127.0.0.1:8081/tomee/ejb";);
 BusinessBeanRemote businessBean = (BusinessBeanRemote)
ctx.lookup("BusinessBeanRemote");

All is well and BusinessBean prints out correct user (admin).

Using Local:

 props.put(Context.INITIAL_CONTEXT_FACTORY,
"org.apache.openejb.client.LocalInitialContextFactory");
 props.put(Context.PROVIDER_URL, "http://127.0.0.1:8081/tomee/ejb";);
 BusinessBeanLocal businessBean = (BusinessBeanLocal)
ctx.lookup(BusinessBeanLocal);

Businessbean = guest user.

If I add credentials to local lookup the login exception comes.

br 
hw

 
ti., 17.12.2013 kl. 15.32 +0100, skrev Romain Manni-Bucau:

> Hmm
> 
> Properties props = new Properties();
>         props.put("java.naming.security.principal", "admin");
>         props.put("java.naming.security.credentials", "admin");
> //        props.put("Context.SECURITY_PRINCIPAL", "admin");
> //        props.put("Context.SECURITY_CREDENTIALS", "admin");
>         props.put("openejb.authentication.realmName", "PropertiesLogin");
>         props.put("openejb.ejbd.authenticate-with-request", "true");
>         props.put(Context.INITIAL_CONTEXT_FACTORY,
> "org.apache.openejb.client.LocalInitialContextFactory");
>         props.put(Context.PROVIDER_URL, "http://127.0.0.1:8081/tomee/ejb";);
> 
> If you use LocalInitialContextFactory you don't need other props since
> that's a local lookup and you'll simply reuse the current context. Did you
> intend to use RemoteInitialContextFactory?
> 
> *Romain Manni-Bucau*
> *Twitter: @rmannibucau <https://twitter.com/rmannibucau>*
> *Blog: **http://rmannibucau.wordpress.com/*<http://rmannibucau.wordpress.com/>
> *LinkedIn: **http://fr.linkedin.com/in/rmannibucau
> <http://fr.linkedin.com/in/rmannibucau>*
> *Github: https://github.com/rmannibucau <https://github.com/rmannibucau>*
> 
> 
> 
> 2013/12/17 Helge Waastad <[email protected]>
> 
> >  Sure, I'm happy to [image: :-)]
> >
> > Here's som testcode I've been testing.
> > there are 3 nodes for testing failover, but right now it's only node1
> > working (I think...)
> > https://github.com/hwaastad/QuartsApp.git
> >
> > runs on localhost:8081/QuartsApp
> >
> > user: admin/admin
> >
> > I guess you need quartz postgres db aswell.
> >
> > mvn tomee:run -Pnode1
> >
> > hw
> >
> >
> > ti., 17.12.2013 kl. 12.19 +0100, skrev Romain Manni-Bucau:
> >
> > Can you share some code please to fix ideas?
> > Romain Manni-Bucau
> > Twitter: @rmannibucau
> > Blog: http://rmannibucau.wordpress.com/
> > LinkedIn: http://fr.linkedin.com/in/rmannibucau
> > Github: https://github.com/rmannibucau
> >
> >
> >
> > 2013/12/17 hwaastad <[email protected]>:
> > > Hi Romain,
> > > I'll try to be more specific:
> > >
> > > My job will call an EJB for processing data.
> > >
> > > The method called is secured by @rolesallowed and, as you say, jobs are'nt
> > > managed object. so I have to lookup the EJB.
> > > Right now I'm trying to add credentials via:
> > >
> > > props.put("java.naming.security.principal", "admin");
> > > props.put("java.naming.security.credentials", "admin");
> > > props.put("openejb.authentication.realmName", "PropertiesLogin");
> > > props.put("openejb.ejbd.authenticate-with-request", "true");
> > > props.put(Context.INITIAL_CONTEXT_FACTORY,
> > > "org.apache.openejb.client.LocalInitialContextFactory");
> > > props.put(Context.PROVIDER_URL, "http://127.0.0.1:8080/tomee/ejb";);
> > >
> > > But now I get:
> > > javax.security.auth.login.LoginException: Thread already associated with a
> > > client identity.  Refusing to overwrite.
> > >
> > > I'm maybe barking up the wrong tree here and maybe I'll have to redesign 
> > > my
> > > older @schedule jobs to "unsecured" ejb's.
> > > As always: Work in Progress :-)
> > >
> > > br,
> > > hw
> > >
> > >
> > >
> > >
> > >
> > >
> > >
> > > --
> > > View this message in context: 
> > > http://openejb.979440.n4.nabble.com/TomEE-and-persistent-timers-tp4666750p4666780.html
> > > Sent from the OpenEJB User mailing list archive at Nabble.com.
> >
> >
> >


Reply via email to