Hi Anastasia,
 
I think this is my last problem to fix to reach my goal!!!!!
"Be sure to add the right passwords in your password callback class...
Good luck"

I've added the usernamen and the password of the client_keystore in the client side PWCallaback.class but this is the exception:
 
General security error (WSSecurityEngine: Callback supplied no password for: secureserver)
 
 
secureserver is the alias of the srver_keystore but there are some problems.
 
PWCallback (client)
 
package prova.client;

import java.io.IOException;
import javax.security.auth.callback.Callback;
import javax.security.auth.callback.CallbackHandler;
import javax.security.auth.callback.UnsupportedCallbackException;
import org.apache.ws.security.WSPasswordCallback;
_/**
 * PWCallback for the Client
 */
public class PWCallback implements CallbackHandler {
 _/**
  * @see javax.security.auth.callback.CallbackHandler#handle(javax.security.auth.callback.Callback[])
  */
 public void handle(Callback[] callbacks) throws IOException,
   UnsupportedCallbackException {
  for (int i = 0; i < callbacks.length; i++) {
   if (callbacks[i] instanceof WSPasswordCallback) {
    WSPasswordCallback pc = (WSPasswordCallback) callbacks[i];
    // set the password given a username
    if ("wss4j".equals(pc.getIdentifer())) {
     pc.setPassword("security");
    }
   } else {
    throw new UnsupportedCallbackException(callbacks[i],
      "Unrecognized Callback");
   }
  }
 }
}
 
PWCallback (server)
 
import java.io.IOException;
import javax.security.auth.callback.Callback;
import javax.security.auth.callback.CallbackHandler;
import javax.security.auth.callback.UnsupportedCallbackException;
import org.apache.ws.security.WSPasswordCallback;
public class PWCallback implements CallbackHandler {
    public void handle(Callback[] callbacks) throws IOException, UnsupportedCallbackException {
        for (int i = 0; i < callbacks.length; i++) {
            if (callbacks[i] instanceof WSPasswordCallback) {
                WSPasswordCallback pc = (WSPasswordCallback)callbacks[i];
                // set the password given a username
                if ("wss4j".equals(pc.getIdentifer())) {
                    pc.setPassword("changeit");
                }
            } else {
                throw new UnsupportedCallbackException(callbacks[i], "Unrecognized Callback");
            }
        }
    }
}
 
Thanks for the reply!


__________________________________________________
Do You Yahoo!?
Poco spazio e tanto spam? Yahoo! Mail ti protegge dallo spam e ti da tanto spazio gratuito per i tuoi file e i messaggi
http://mail.yahoo.it

Reply via email to