0 Replies Latest reply on Aug 2, 2012 7:25 AM by Vadim Gusev

    Dynamic provide user login & password via remote connection from different thread

    Vadim Gusev Newbie

      Hello

       

      I create remote connections with EjbClientContext and use following CallBackHandler to provide user information:

       

       

      class AuthenticationCallbackHandler implements CallbackHandler {
      
      
                          public void handle(Callback[] callbacks) throws IOException, UnsupportedCallbackException {
      
      
                                    for (Callback current : callbacks) {
                                              if (current instanceof NameCallback) {
                                                        NameCallback ncb = (NameCallback) current;
                                                        ncb.setName("admin");
                                              } else if (current instanceof PasswordCallback) {
                                                        PasswordCallback pcb = (PasswordCallback) current;
                                                        pcb.setPassword("admin".toCharArray());
                                              } else {
                                                        throw new UnsupportedCallbackException(current);
                                              }
                                    }
                          }
                }
      
      

       

      now I use hardcoded user name and password for all invocations.

       

      But I need to do next: webconsole use many threads where it uses remote ejb, and each thread contain users information(many users could work with console at one time).

      I need to dynamically provide user information from different threads via remote connection, but I don't understand how to do that, because AuthenticationCallbackHandler handle invocations in another thread. How to put user information into this callback?