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)
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…
Cancel
Save