Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.
Bug 358486 - Make it easier to use JGit in a web-server
Summary: Make it easier to use JGit in a web-server
Status: NEW
Alias: None
Product: JGit
Classification: Technology
Component: JGit (show other bugs)
Version: unspecified   Edit
Hardware: All All
: P3 enhancement (vote)
Target Milestone: ---   Edit
Assignee: Project Inbox CLA
QA Contact:
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2011-09-21 16:08 EDT by Thomas Hallgren CLA
Modified: 2011-09-21 17:06 EDT (History)
1 user (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Thomas Hallgren CLA 2011-09-21 16:08:18 EDT
The use-case is a servlet engine that servers many users. A user in this context, is not an operating system user. This means that the SshSessionFactory (we're using key pairs, not passwords) and SystemReader used by JGit must be provided by other means.

Today, this can be done in one of two ways:

Synchronize all jgit operations and use a prologue/epilogue where the SshSessionFactory and SystemReader is first assigned and then, once the command has completed, reset to what they were before.

OR

Create a SshSessionFactory and SystemReader that uses InheritableThreadLocal instances to store user specific credentials and config. This way, they can be assigned once when the process starts, and the prologue need only initialize the thread local with correct data. The advantage with this approach is that it doesn't need to be synchronized and several JGit actions can run in parallel. This approach will break if JGit would use a thread pool.

I'm not overly happy with any of them. What I would like to have is a way to pass the SshSessionFactory and SystemReader to each command that is executed rather than having to assign them to a static variable. Perhaps this could be done as an extension to the CredentialsProvider?