Browse Source

Enable retrieval of credentials from .netrc for AwtCredentialsProvider

This was done for ConsoleCredentialsProvider earlier, we need the
AwtCredentialsProvider for debugging jgit command line since there is no
console in Eclipse. Hence also add support for .netrc here.

Change-Id: Ibbd45b73efc663821866754454cea65e6d03f832
Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
stable-4.3
Matthias Sohn 9 years ago committed by Christian Halstrick
parent
commit
741829f177
  1. 7
      org.eclipse.jgit.ui/src/org/eclipse/jgit/awtui/AwtCredentialsProvider.java

7
org.eclipse.jgit.ui/src/org/eclipse/jgit/awtui/AwtCredentialsProvider.java

@ -56,15 +56,20 @@ import javax.swing.JPasswordField;
import javax.swing.JTextField; import javax.swing.JTextField;
import org.eclipse.jgit.errors.UnsupportedCredentialItem; import org.eclipse.jgit.errors.UnsupportedCredentialItem;
import org.eclipse.jgit.transport.ChainingCredentialsProvider;
import org.eclipse.jgit.transport.CredentialItem; import org.eclipse.jgit.transport.CredentialItem;
import org.eclipse.jgit.transport.CredentialsProvider; import org.eclipse.jgit.transport.CredentialsProvider;
import org.eclipse.jgit.transport.NetRCCredentialsProvider;
import org.eclipse.jgit.transport.URIish; import org.eclipse.jgit.transport.URIish;
/** Interacts with the user during authentication by using AWT/Swing dialogs. */ /** Interacts with the user during authentication by using AWT/Swing dialogs. */
public class AwtCredentialsProvider extends CredentialsProvider { public class AwtCredentialsProvider extends CredentialsProvider {
/** Install this implementation as the default. */ /** Install this implementation as the default. */
public static void install() { public static void install() {
CredentialsProvider.setDefault(new AwtCredentialsProvider()); final AwtCredentialsProvider c = new AwtCredentialsProvider();
CredentialsProvider cp = new ChainingCredentialsProvider(
new NetRCCredentialsProvider(), c);
CredentialsProvider.setDefault(cp);
} }
@Override @Override

Loading…
Cancel
Save