views:

23

answers:

0

Hello, I need to access the clients principal (username ) inside a ejb method. I don't want to add it as a parameter. Tryed adding them to Context object like ;

prop.add(Context.SECURITY_AUTHENTICATION,"user")
prop.add(Context.SECURITY_CREDENTIALS,"pass")

but trying to access them inside the method like; @Resource private SessionContext ctx;

public void someMethod() {
    Principal principal = ctx.getCallerPrincipal();
    //returns anonymous

still give me the annoymous user.

Working on weblogic, any pointers ?

Thanks