diff options
author | James Moger <james.moger@gitblit.com> | 2014-03-08 19:10:53 -0500 |
---|---|---|
committer | James Moger <james.moger@gitblit.com> | 2014-04-10 18:58:07 -0400 |
commit | 85fbc79605d886b2b4ec02aa8cfb5b8b05436576 (patch) | |
tree | 008472f57ad3b76c3dbb2b04fbf236c49316cab3 | |
parent | 31f477050f223b975bce4862a6aa415ee3045857 (diff) | |
download | gitblit-85fbc79605d886b2b4ec02aa8cfb5b8b05436576.tar.gz gitblit-85fbc79605d886b2b4ec02aa8cfb5b8b05436576.zip |
Authenticate SSH upload pack
-rw-r--r-- | src/main/java/com/gitblit/git/GitblitUploadPackFactory.java | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/src/main/java/com/gitblit/git/GitblitUploadPackFactory.java b/src/main/java/com/gitblit/git/GitblitUploadPackFactory.java index 39ad0724..a72d4ad9 100644 --- a/src/main/java/com/gitblit/git/GitblitUploadPackFactory.java +++ b/src/main/java/com/gitblit/git/GitblitUploadPackFactory.java @@ -26,6 +26,7 @@ import org.eclipse.jgit.transport.resolver.UploadPackFactory; import com.gitblit.manager.IAuthenticationManager; import com.gitblit.models.UserModel; import com.gitblit.transport.git.GitDaemonClient; +import com.gitblit.transport.ssh.SshSession; /** * The upload pack factory creates an upload pack which controls what refs are @@ -62,6 +63,13 @@ public class GitblitUploadPackFactory<X> implements UploadPackFactory<X> { GitDaemonClient client = (GitDaemonClient) req; // set timeout from Git daemon timeout = client.getDaemon().getTimeout(); + } else if (req instanceof SshSession) { + // SSH request is always authenticated + SshSession client = (SshSession) req; + user = authenticationManager.authenticate(client); + if (user == null) { + throw new ServiceNotAuthorizedException(); + } } UploadPack up = new UploadPack(db); |