public void handle(Callback[] callbacks) throws IOException, UnsupportedCallbackException {
for (int i = 0; i < callbacks.length; i++) {
//When the server side need to authenticate the user
WSPasswordCallback pwcb = (WSPasswordCallback)callbacks[i];
if (pwcb.getUsage() == WSPasswordCallback.USERNAME_TOKEN_UNKNOWN) {
if(pwcb.getIdentifer().equals("alice") && pwcb.getPassword().equals("bobPW")) {
return;
} else {
throw new UnsupportedCallbackException(callbacks[i], "check failed");
}
}
//When the client requests for the password to be added in to the
//UT element
pwcb.setPassword("bobPW");
}
}
|