Browse Source

UnsupportedCredentialItem with password authentication

If the server prompts for password, it comes as a StringType prompt.

Bug: 360862
Change-Id: Ic758456c21c8d68d1b3d7f56228beb7535b11735
stable-2.0
Robin Rosenberg 13 years ago
parent
commit
2047eaa4c2
  1. 21
      org.eclipse.jgit/src/org/eclipse/jgit/transport/UsernamePasswordCredentialsProvider.java

21
org.eclipse.jgit/src/org/eclipse/jgit/transport/UsernamePasswordCredentialsProvider.java

@ -100,14 +100,23 @@ public class UsernamePasswordCredentialsProvider extends CredentialsProvider {
public boolean get(URIish uri, CredentialItem... items) public boolean get(URIish uri, CredentialItem... items)
throws UnsupportedCredentialItem { throws UnsupportedCredentialItem {
for (CredentialItem i : items) { for (CredentialItem i : items) {
if (i instanceof CredentialItem.Username) if (i instanceof CredentialItem.Username) {
((CredentialItem.Username) i).setValue(username); ((CredentialItem.Username) i).setValue(username);
continue;
else if (i instanceof CredentialItem.Password) }
if (i instanceof CredentialItem.Password) {
((CredentialItem.Password) i).setValue(password); ((CredentialItem.Password) i).setValue(password);
continue;
else }
throw new UnsupportedCredentialItem(uri, i.getPromptText()); 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; return true;
} }

Loading…
Cancel
Save