public boolean get(URIish uri, CredentialItem... items)
throws UnsupportedCredentialItem {
for (CredentialItem i : items) {
- if (i instanceof CredentialItem.Username)
+ if (i instanceof CredentialItem.Username) {
((CredentialItem.Username) i).setValue(username);
-
- else if (i instanceof CredentialItem.Password)
+ continue;
+ }
+ if (i instanceof CredentialItem.Password) {
((CredentialItem.Password) i).setValue(password);
-
- else
- throw new UnsupportedCredentialItem(uri, i.getPromptText());
+ continue;
+ }
+ if (i instanceof CredentialItem.StringType) {
+ if (i.getPromptText().equals("Password: ")) {
+ ((CredentialItem.StringType) i).setValue(new String(
+ password));
+ continue;
+ }
+ }
+ throw new UnsupportedCredentialItem(uri, i.getClass().getName()
+ + ":" + i.getPromptText());
}
return true;
}