Bug 489870 - RFE: ExtensionPoint EclipseSshSessionFactory
Summary: RFE: ExtensionPoint EclipseSshSessionFactory
Status: NEW
Alias: None
Product: EGit
Classification: Technology
Component: Core (show other bugs)
Version: 4.2   Edit
Hardware: PC Windows NT
: P3 normal (vote)
Target Milestone: ---   Edit
Assignee: Project Inbox CLA
QA Contact:
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2016-03-17 12:52 EDT by kurt CLA
Modified: 2016-04-03 15:51 EDT (History)
2 users (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description kurt CLA 2016-03-17 12:52:59 EDT
We have to configure the session-properties of the 
JSch-instance via .setConfig(String,String).
For example, one of the properties is telling JSch to instantiate a
special class on certain connections (dependent on the target host).

As far as I can see, the best place to have an extension-point for that,
would be in

  EclipseSshSessionFactory.configure(OpenSshConfig.Host hc, Session session)

after or instead of the default configuration there.

At the moment I set my own SshSessionFactory, which is a subclass of
JschConfigSessionFactory and implements the configure-method.

The two reasons for subclassung that instead of EclipseSshSessionFactory is,
that the latter is placed in egit.ui (egit.core would be a better place) and
that it is not public.

This solution is not ideal - but at least looks like working.

If you could provide an extension-point like the one mentioned above,
I'd happily change my code for that.

In case you do, please consider moving EclipseSshSessionFactory from
egit.ui- to egit.core-plugin also (I am using that in a 'headless' plugin).

Thx & greetings
Kurt
Comment 1 Matthias Sohn CLA 2016-03-18 04:33:46 EDT
I think it's a good idea to move this code to the egit.core bundle as it has no UI dependencies. There are some more classes in the same package which would better be located in egit.core. I'll look into this.

What kind of configuration do you want to apply on the session factory for what reason ?
Comment 2 kurt CLA 2016-03-18 08:24:19 EDT
In the configure-method for the factory we are setting some properties,
like MaxAuthTries and the like on the session. But also our own UserInfo
and a class (the name) for gssapi-authentication, which JSch instantiates
and uses then.

So instead of setting our own ssh-session-factory, it probably would be
more 'compatible' if there would be an extension-point as mentioned before.
Comment 3 Matthias Sohn CLA 2016-03-22 19:57:02 EDT
(In reply to Matthias Sohn from comment #1)
> I think it's a good idea to move this code to the egit.core bundle as it has
> no UI dependencies. There are some more classes in the same package which
> would better be located in egit.core. I'll look into this.

EclipseSshSessionFactory.configure() is using UserInfoPrompter which is a UI dependency. Maybe we can adapt this to JGit's CredentialsProvider.getDefault() which in EGit is set to EGitCredentialsProvider which comes from org.eclipse.egit.ui
Comment 4 Eclipse Genie CLA 2016-03-22 20:14:08 EDT
New Gerrit change created: https://git.eclipse.org/r/69087
Comment 5 Eclipse Genie CLA 2016-04-03 15:51:34 EDT
Gerrit change https://git.eclipse.org/r/69087 was merged to [master].
Commit: http://git.eclipse.org/c/egit/egit.git/commit/?id=ae26a5b3cf07a41ead52f27791d5c1f82325cfa5