Переглянути джерело

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>
tags/v5.12.0.202105051250-m2
Thomas Wolf 3 роки тому
джерело
коміт
0c91bf4e17

+ 17
- 7
org.eclipse.jgit/src/org/eclipse/jgit/transport/UsernamePasswordCredentialsProvider.java Переглянути файл

/* /*
* 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 * This program and the accompanying materials are made available under the
* terms of the Eclipse Distribution License v. 1.0 which is available at * terms of the Eclipse Distribution License v. 1.0 which is available at
@Override @Override
public boolean supports(CredentialItem... items) { public boolean supports(CredentialItem... items) {
for (CredentialItem i : items) { for (CredentialItem i : items) {
if (i instanceof CredentialItem.Username)
if (i instanceof CredentialItem.InformationalMessage) {
continue; continue;
else if (i instanceof CredentialItem.Password)
}
if (i instanceof CredentialItem.Username) {
continue; 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; return true;
} }
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.InformationalMessage) {
continue;
}
if (i instanceof CredentialItem.Username) { if (i instanceof CredentialItem.Username) {
((CredentialItem.Username) i).setValue(username); ((CredentialItem.Username) i).setValue(username);
continue; continue;

Завантаження…
Відмінити
Зберегти