java ee - Security Multi-user Client: Bad remote CallerPrincipal when connecting 2 users from my client -


i have annoying issue secured glassfish 3.1.2. when connect 2 (or more) users stand-alone client, having last connected user when try caller principal ejb:

     sessioncontext.getcallerprincipal().getname();     

could please give me on issue?

here client:

<pre>     public static void main(string[] args) {         new thread(new runnable() {           @override           public void run() {              connectuser("usera", "pwdb");           }         }).start();         new thread(new runnable() {                @override            public void run() {                 connectuser("userb", "pwdb");            }         }).start();     }     public static void connectuser(string username, string password) {      try {          programmaticlogin login = new programmaticlogin();          login.login(username, password.tochararray());          context context = new initialcontext();          myserviceremote myservice = (myserviceremote) context.lookup("myservice");          string remotecaller = myservice.getusername();          system.out.println("local (" + username + "), remote (" + remotecaller + ")");       } catch (exception e) {          e.printstacktrace();       }     }  </pre> 

here ejb:

<pre>     @stateless(mappedname = "myservice", name="myservicebean")     public class myservicebean implements myserviceremote{         @resource         private sessioncontext sessioncontext;         public myservicebean () {             super();                 }         public string getusername() {             return sessioncontext.getcallerprincipal().getname();         }     }  </pre> 


Comments

Popular posts from this blog

php - Wordpress website dashboard page or post editor content is not showing but front end data is showing properly -

javascript - Get parameter of GET request -

javascript - Twitter Bootstrap - how to add some more margin between tooltip popup and element -