public void handle(Callback[] callbacks) throws IOException, UnsupportedCallbackException { WSPasswordCallback pc = (WSPasswordCallback) callbacks[0]; if (pc.getIdentifer().equals("joe")) { // set the password on the callback. This will be compared to the // password which was sent from the client. pc.setPassword("password"); } }
public void handle(Callback[] callbacks) throws UnsupportedCallbackException { String userId = getUserName(); String passwd = getPassword(); for (int i = 0; i < callbacks.length; i++) { if (callbacks[i] instanceof WSPasswordCallback) { WSPasswordCallback pc = (WSPasswordCallback) callbacks[i]; if (pc.getIdentifer().equals(userId)) { pc.setPassword(passwd); } } else { throw new UnsupportedCallbackException(callbacks[i], "Unrecognized Callback"); } } }