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];
if (pc.getUsage() == WSPasswordCallback.USERNAME_TOKEN) {
if ("wernerd".equals(pc.getIdentifier())) {
// Base64 encoded SHA-1 hash of "verySecret"
pc.setPassword("hGqoUreBgahTJblQ3DbJIkE6uNs=");
} else if ("bob".equals(pc.getIdentifier())) {
// Base64 encoded SHA-1 hash of "security"
pc.setPassword("jux7xGGAjguKKHg9C+waOiLrCCE=");
}
}
} else {
throw new UnsupportedCallbackException(callbacks[i], "Unrecognized Callback");
}