UnsupportedCredentialItem with password authentication
If the server prompts for password, it comes as a StringType prompt. Bug: 360862 Change-Id: Ic758456c21c8d68d1b3d7f56228beb7535b11735
This commit is contained in:
parent
e0531ace35
commit
2047eaa4c2
|
@ -100,14 +100,23 @@ else if (i instanceof CredentialItem.Password)
|
|||
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;
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue