Community
Participate
Working Groups
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?