Browse Source

Merge "UnsupportedCredentialItem with password authentication"

stable-2.0
Robin Rosenberg 13 years ago committed by Gerrit Code Review @ Eclipse.org
parent
commit
32be70d209
  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