This discussion is archived
1 Reply Latest reply: Jun 11, 2012 1:30 AM by gimbal2 RSS

Problem with EJB Authentication

942706 Newbie
Currently Being Moderated
Hi!

I'm using Glassfish to develope an application and I've a problem: I don't know how to propagate credentials from the EJB's caller (a desktop application) to the server. I wrote this:

Properties prop=new Properties();
prop.setProperty("org.omg.CORBA.ORBInitialHost","localhost");
prop.setProperty("org.omg.CORBA.ORBInitialPort","3700");
prop.setProperty("java.naming.security.principal","alexweb");
prop.setProperty("java.naming.security.credentials","abcde");
InitialContext ctx=new InitialContext(prop);
JndiEJBRemote bean=(JndiEJBRemote)ctx.lookup("java:global/JndiPrueba1JndiPrueba1-ejb/JndiEJB");

And then, I call a bean's method that returns an string with the caller's principal, like this:

ctx.getCallerPrincipal().getName();

But I obtain "ANONYMOUS". Can somebody tell me why? Thank you guys!

Edited by: 939703 on 10-jun-2012 1:00

Legend

  • Correct Answers - 10 points
  • Helpful Answers - 5 points