} else {
Set creds = subject.getPrivateCredentials(NamedUsernamePasswordCredential.class);
boolean found = false;
for (Iterator iterator = creds.iterator(); iterator.hasNext();) {
NamedUsernamePasswordCredential namedUsernamePasswordCredential = (NamedUsernamePasswordCredential) iterator.next();
if (credentialsName.equals(namedUsernamePasswordCredential.getName())) {
proxy.getRequestContext().put(BindingProvider.USERNAME_PROPERTY,
namedUsernamePasswordCredential.getUsername());
proxy.getRequestContext().put(BindingProvider.PASSWORD_PROPERTY,
new String(namedUsernamePasswordCredential.getPassword()));
LOG.debug("Set username/password property: " + credentialsName);
found = true;
break;
}
}