With the SecurityInterceptor patch I checked in this morning I see the call principal
propagated from a session bean to an entity bean. I have a simply test case where
a stateless session bean invokes an entity bean and both see the same principal:
 
public class StatelessSessionBean2 implements SessionBean
{
...
    public String echo(String arg)
    {
        System.out.println("StatelessSessionBean2.echo, arg="+arg);
        Principal p = sessionContext.getCallerPrincipal();
        System.out.println("StatelessSessionBean2.echo, callerPrincipal="+p);
        String echo = null;
        try
        {
            InitialContext ctx = new InitialContext();
            EntityHome home = (EntityHome) ctx.lookup("java:comp/env/Entity");
            Entity entity = home.findByPrimaryKey(arg);
            echo = entity.echo(arg);
        }
        catch(Exception e)
        {
            e.printStackTrace();
        }
        return echo;
    }
...
 
Can you try the latest cvs code?
----- Original Message -----
To: jBoss
Sent: Thursday, January 25, 2001 5:08 AM
Subject: Re: 2 [jBoss-User] CallerPrincipal propagation

Hi Keith,

So how u fixed problem with getCallerPrincipal()?

I have the same problem:
I use JBoss pre21, default configuration
Client sets org.jboss.security.SecurityAssociation.setPrincipal( aDialogPrincipal )

on the server side in the stateless session bean i call getCallerPrincipal() and it returns correct principal.
From the session bean i calling entity bean where getCallerPrincipal() returns NULL.

I looked throw source code i have found Your
WORKAROUND:

public void setPrincipal( Principal principal ){
this.principal = principal;
this.beanPrincipal = null;
SecurityAssociation.setPrincipal(principal);
}

helps me.

But in the next letter you cancelled the sugestion. So how to do i get the correct getCallerPrincipal() in the entity bean too.
I would like WORKAROUND commited :) till the better sollution is found.

Reply via email to