diff options
author | Thomas Wolf | 2018-10-20 14:47:52 +0000 |
---|---|---|
committer | Thomas Wolf | 2018-11-17 17:57:51 +0000 |
commit | 33cc25fcead0ed86bd61c0f87625aac1dcaf6b90 (patch) | |
tree | c9fa7bece549ab658933d1af2c25f25a5550a152 /org.eclipse.egit.ui | |
parent | 2f75c631e5f4e5f0354d18ff0311abf69c6db8bc (diff) | |
download | egit-33cc25fcead0ed86bd61c0f87625aac1dcaf6b90.tar.gz egit-33cc25fcead0ed86bd61c0f87625aac1dcaf6b90.tar.xz egit-33cc25fcead0ed86bd61c0f87625aac1dcaf6b90.zip |
Include the Apache MINA ssh client
Add a preference with UI in the main Git preference page to select
between JSch and the new Apache MINA sshd client.
Read preferences from the org.eclipse.jsch.core preference node and
install a listener to pick up preference changes.
The session factory thus can use the ssh preferences as configured by
the user. For the time being, we use the ssh directory, the default
identities, and the preferred authentication mechanisms. The latter
two can be overridden through the ssh config file, which will be the
one in the configured ssh directory. The other preferences from
org.eclipse.jsch are not taken into account; sshd may have different
algorithms available and I don't want to change preferences in a
foreign bundle.
Make the proxy service accessible in the EGit core activator, and use
it in a ProxyDataFactory in the EGitSshdSessionFactory.
The EGitSshdSessionFactory has no key cache. Eclipse is a long-running
application, and keeping ssh keys in memory for that long is most
probably not wise. Instead re-load keys whenever they are needed, and
use an IdentityPasswordProvider (which provides passwords for encrypted
private key files) that uses the Eclipse secure storage for key
passphrases to avoid repeatedly asking the user for the same passphrases
for the same keys.
Bug: 520927
JGit-Dependency: Iaa78bbb998a5e574fa091664b75c48a3b9cfb897
Change-Id: Id3cf850c4e132e864eab7eda52c20ff379e2b1d9
Signed-off-by: Thomas Wolf <thomas.wolf@paranor.ch>
Diffstat (limited to 'org.eclipse.egit.ui')
4 files changed, 40 insertions, 7 deletions
diff --git a/org.eclipse.egit.ui/src/org/eclipse/egit/ui/internal/UIText.java b/org.eclipse.egit.ui/src/org/eclipse/egit/ui/internal/UIText.java index 5aed045a9b..abf64edea1 100644 --- a/org.eclipse.egit.ui/src/org/eclipse/egit/ui/internal/UIText.java +++ b/org.eclipse.egit.ui/src/org/eclipse/egit/ui/internal/UIText.java @@ -715,6 +715,12 @@ public class UIText extends NLS { public static String GitPreferenceRoot_SecureStoreUseByDefault; /** */ + public static String GitPreferenceRoot_SshClient_Jsch_Label; + + /** */ + public static String GitPreferenceRoot_SshClient_Apache_Label; + + /** */ public static String GitPreferenceRoot_useLogicalModel; /** */ @@ -4865,6 +4871,9 @@ public class UIText extends NLS { public static String GitPreferenceRoot_MaxPullThreadsCountTooltip; /** */ + public static String RemoteConnectionPreferencePage_SshClientLabel; + + /** */ public static String RemoteConnectionPreferencePage_TimeoutLabel; /** */ diff --git a/org.eclipse.egit.ui/src/org/eclipse/egit/ui/internal/credentials/EGitCredentialsProvider.java b/org.eclipse.egit.ui/src/org/eclipse/egit/ui/internal/credentials/EGitCredentialsProvider.java index 3b68cccff4..4d543df394 100644 --- a/org.eclipse.egit.ui/src/org/eclipse/egit/ui/internal/credentials/EGitCredentialsProvider.java +++ b/org.eclipse.egit.ui/src/org/eclipse/egit/ui/internal/credentials/EGitCredentialsProvider.java @@ -50,7 +50,9 @@ public class EGitCredentialsProvider extends CredentialsProvider { */ public EGitCredentialsProvider(String user, String password) { this.user = user; - this.password = password; + // If the password is empty try secure store or ask the user + this.password = password != null && password.isEmpty() ? null + : password; } @Override diff --git a/org.eclipse.egit.ui/src/org/eclipse/egit/ui/internal/preferences/GitPreferenceRoot.java b/org.eclipse.egit.ui/src/org/eclipse/egit/ui/internal/preferences/GitPreferenceRoot.java index dfc9d9d336..3e6b633635 100644 --- a/org.eclipse.egit.ui/src/org/eclipse/egit/ui/internal/preferences/GitPreferenceRoot.java +++ b/org.eclipse.egit.ui/src/org/eclipse/egit/ui/internal/preferences/GitPreferenceRoot.java @@ -54,6 +54,8 @@ public class GitPreferenceRoot extends DoublePreferencesPreferencePage private final static String[][] MERGE_MODE_NAMES_AND_VALUES = new String[3][2]; + private final static String[][] SSH_CLIENT_NAMES_AND_VALUES = new String[2][2]; + private final static boolean HAS_DEBUG_UI = hasDebugUiBundle(); static { @@ -63,6 +65,11 @@ public class GitPreferenceRoot extends DoublePreferencesPreferencePage MERGE_MODE_NAMES_AND_VALUES[1][1] = "1";//$NON-NLS-1$ MERGE_MODE_NAMES_AND_VALUES[2][0] = UIText.GitPreferenceRoot_MergeMode_2_Label; MERGE_MODE_NAMES_AND_VALUES[2][1] = "2"; //$NON-NLS-1$ + + SSH_CLIENT_NAMES_AND_VALUES[0][0] = UIText.GitPreferenceRoot_SshClient_Jsch_Label; + SSH_CLIENT_NAMES_AND_VALUES[0][1] = "jsch"; //$NON-NLS-1$ + SSH_CLIENT_NAMES_AND_VALUES[1][0] = UIText.GitPreferenceRoot_SshClient_Apache_Label; + SSH_CLIENT_NAMES_AND_VALUES[1][1] = "apache"; //$NON-NLS-1$ } /** @@ -206,6 +213,18 @@ public class GitPreferenceRoot extends DoublePreferencesPreferencePage timeoutEditor.getLabelControl(remoteConnectionsGroup).setToolTipText( UIText.RemoteConnectionPreferencePage_ZeroValueTooltip); addField(timeoutEditor); + ComboFieldEditor sshClient = new ComboFieldEditor( + GitCorePreferences.core_sshClient, + UIText.RemoteConnectionPreferencePage_SshClientLabel, + SSH_CLIENT_NAMES_AND_VALUES, remoteConnectionsGroup) { + + @Override + public IPreferenceStore getPreferenceStore() { + return getSecondaryPreferenceStore(); + } + + }; + addField(sshClient); updateMargins(remoteConnectionsGroup); Group repoChangeScannerGroup = new Group(main, SWT.SHADOW_ETCHED_IN); diff --git a/org.eclipse.egit.ui/src/org/eclipse/egit/ui/internal/uitext.properties b/org.eclipse.egit.ui/src/org/eclipse/egit/ui/internal/uitext.properties index e1cbc94029..1ac2769702 100644 --- a/org.eclipse.egit.ui/src/org/eclipse/egit/ui/internal/uitext.properties +++ b/org.eclipse.egit.ui/src/org/eclipse/egit/ui/internal/uitext.properties @@ -241,7 +241,7 @@ GitHistoryPage_toggleEmailAddresses=&E-mail Addresses GitLightweightDecorator_name=Git resource decorations GitPreferenceRoot_automaticallyEnableChangesetModel=Automatically enable commit &grouping in Git synchronizations GitPreferenceRoot_BlameGroupHeader=Revision Information -GitPreferenceRoot_BlameIgnoreWhitespaceLabel=Ignore whitespace changes +GitPreferenceRoot_BlameIgnoreWhitespaceLabel=Ignore &whitespace changes GitPreferenceRoot_fetchBeforeSynchronization=Always launch fetch before synchronization GitPreferenceRoot_CloningRepoGroupHeader=Cloning repositories GitPreferenceRoot_DefaultRepoFolderLabel=Default repository &folder: @@ -256,14 +256,16 @@ GitPreferenceRoot_MergeModeTooltip=Determines which content to be displayed on t GitPreferenceRoot_RemoteConnectionsGroupHeader=Remote connections GitPreferenceRoot_RepoChangeScannerGroupHeader=Automatic refresh GitPreferenceRoot_SecureStoreGroupLabel=Secure Store -GitPreferenceRoot_SecureStoreUseByDefault=Store credentials in secure store by default +GitPreferenceRoot_SecureStoreUseByDefault=Store credentials in secure store by &default +GitPreferenceRoot_SshClient_Jsch_Label=JSch +GitPreferenceRoot_SshClient_Apache_Label=Apache MINA sshd GitPreferenceRoot_useLogicalModel=Allow models (e.g., Java, EMF) to participate in synchronizations GitPreferenceRoot_preferreMergeStrategy_label=You can select a specific merge strategy below\nto override the default JGit merge behavior for merge operations\n(merge, rebase, pull, revert, squash, stash, submodule update) GitPreferenceRoot_preferreMergeStrategy_group=Preferred merge strategy for operations that require merges GitPreferenceRoot_defaultMergeStrategyLabel=Default Strategy (as defined by JGit) GitPreferenceRoot_lfsSupportCaption=LFS support GitPreferenceRoot_lfsSupportCaptionNotAvailable=LFS support (not installed) -GitPreferenceRoot_lfsSupportInstall=Enable LFS support globally (for the current user) +GitPreferenceRoot_lfsSupportInstall=Enable &LFS support globally (for the current user) GitPreferenceRoot_lfsSupportSuccessMessage=LFS support has been installed for the current user. GitPreferenceRoot_lfsSupportSuccessTitle=LFS configured GitProjectPropertyPage_LabelBranch=Branch: @@ -1056,10 +1058,10 @@ ProjectsPreferencePage_AutoShareProjects=Automatically share projects located in ProjectsPreferencePage_RestoreBranchProjects=Track each branch's imported projects and restore on checkout ProjectsPreferencePage_AutoIgnoreDerivedResources=Automatically ignore derived resources by adding them to .gitignore -RefreshPreferencesPage_RefreshIndexInterval=Refre&sh interval (seconds): +RefreshPreferencesPage_RefreshIndexInterval=Refresh &interval (seconds): RefreshPreferencesPage_RefreshIndexIntervalTooltip=0 is equivalent to no refresh RefreshPreferencesPage_RefreshOnlyWhenActive=Refresh only when workbench is &active -RefreshPreferencesPage_RefreshWhenIndexChange=Refresh resources when &index changes +RefreshPreferencesPage_RefreshWhenIndexChange=&Refresh resources when index changes RefUpdateElement_CommitCountDecoration=({0}) RefUpdateElement_CommitRangeDecoration=[{0}{1}{2}] RefUpdateElement_statusRejectedNonFastForward=[rejected - non-fast-forward] @@ -1756,7 +1758,8 @@ NotesEditorPage_Title=Notes GitPreferenceRoot_MaxPullThreadsCount=&Maximum number of parallel pulls: GitPreferenceRoot_MaxPullThreadsCountTooltip=1 disables parallel pulls -RemoteConnectionPreferencePage_TimeoutLabel=&Remote connection timeout (seconds): +RemoteConnectionPreferencePage_SshClientLabel=&Ssh client: +RemoteConnectionPreferencePage_TimeoutLabel=&Connection timeout (seconds): RemoteConnectionPreferencePage_ZeroValueTooltip=0 is equivalent to no timeout RemoveCommand_ConfirmDeleteBareRepositoryMessage=This will permanently delete repository ''{0}''.\n\nDo you want to continue? RemoveCommand_ConfirmDeleteBareRepositoryTitle=Delete Bare Repository |