aboutsummaryrefslogtreecommitdiffstats
path: root/org.eclipse.jgit/src/org/eclipse
diff options
context:
space:
mode:
authorThomas Wolf <thomas.wolf@paranor.ch>2021-03-20 18:54:17 +0100
committerThomas Wolf <thomas.wolf@paranor.ch>2021-04-01 19:01:24 +0200
commit0c91bf4e174013f0039f39349e8f83ff0d2e51c3 (patch)
treed5cc6103fc1a4df1d09d0df8aa03beb9a2e0f0c9 /org.eclipse.jgit/src/org/eclipse
parent1de2a9fbe73930504b72904539a3d98d9f9c9738 (diff)
downloadjgit-0c91bf4e174013f0039f39349e8f83ff0d2e51c3.tar.gz
jgit-0c91bf4e174013f0039f39349e8f83ff0d2e51c3.zip
Allow info messages in UsernamePasswordCredentialsProvider
o.e.j.ssh.apache produces passphrase prompts containing InformationalMessage items to show the fingerprint of the key the passphrase is being asked for. Allow this so that the credentials provider can be used with o.e.j.ssh.apache. Change-Id: Ibc2ffd3a987d3118952726091b9b80442972dfd8 Signed-off-by: Thomas Wolf <thomas.wolf@paranor.ch>
Diffstat (limited to 'org.eclipse.jgit/src/org/eclipse')
-rw-r--r--org.eclipse.jgit/src/org/eclipse/jgit/transport/UsernamePasswordCredentialsProvider.java24
1 files changed, 17 insertions, 7 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 979961f2ae..c0de42cb57 100644
--- a/org.eclipse.jgit/src/org/eclipse/jgit/transport/UsernamePasswordCredentialsProvider.java
+++ b/org.eclipse.jgit/src/org/eclipse/jgit/transport/UsernamePasswordCredentialsProvider.java
@@ -1,5 +1,5 @@
/*
- * Copyright (C) 2010, Google Inc. and others
+ * Copyright (C) 2010, 2021 Google Inc. and others
*
* This program and the accompanying materials are made available under the
* terms of the Eclipse Distribution License v. 1.0 which is available at
@@ -58,14 +58,21 @@ public class UsernamePasswordCredentialsProvider extends CredentialsProvider {
@Override
public boolean supports(CredentialItem... items) {
for (CredentialItem i : items) {
- if (i instanceof CredentialItem.Username)
+ if (i instanceof CredentialItem.InformationalMessage) {
continue;
-
- else if (i instanceof CredentialItem.Password)
+ }
+ if (i instanceof CredentialItem.Username) {
continue;
-
- else
- return false;
+ }
+ if (i instanceof CredentialItem.Password) {
+ continue;
+ }
+ if (i instanceof CredentialItem.StringType) {
+ if (i.getPromptText().equals("Password: ")) { //$NON-NLS-1$
+ continue;
+ }
+ }
+ return false;
}
return true;
}
@@ -75,6 +82,9 @@ public class UsernamePasswordCredentialsProvider extends CredentialsProvider {
public boolean get(URIish uri, CredentialItem... items)
throws UnsupportedCredentialItem {
for (CredentialItem i : items) {
+ if (i instanceof CredentialItem.InformationalMessage) {
+ continue;
+ }
if (i instanceof CredentialItem.Username) {
((CredentialItem.Username) i).setValue(username);
continue;