summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRobin Rosenberg <robin.rosenberg@dewire.com>2012-04-09 10:40:28 -0400
committerGerrit Code Review @ Eclipse.org <gerrit@eclipse.org>2012-04-09 10:40:28 -0400
commit32be70d209511ae756a1051180d5fb92f67ba1e5 (patch)
treeb3ccb8319a37cb082795f419aedad72194959c04
parente951b407fa6e028ef07c73ea7be8bbd19fe070f9 (diff)
parent2047eaa4c2206782bf07550cde435e5e4b3721c8 (diff)
downloadjgit-32be70d209511ae756a1051180d5fb92f67ba1e5.tar.gz
jgit-32be70d209511ae756a1051180d5fb92f67ba1e5.zip
Merge "UnsupportedCredentialItem with password authentication"
-rw-r--r--org.eclipse.jgit/src/org/eclipse/jgit/transport/UsernamePasswordCredentialsProvider.java21
1 files changed, 15 insertions, 6 deletions
diff --git a/org.eclipse.jgit/src/org/eclipse/jgit/transport/UsernamePasswordCredentialsProvider.java b/org.eclipse.jgit/src/org/eclipse/jgit/transport/UsernamePasswordCredentialsProvider.java
index 235e4b4b97..db4ac63851 100644
--- a/org.eclipse.jgit/src/org/eclipse/jgit/transport/UsernamePasswordCredentialsProvider.java
+++ b/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;
}