summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJames Moger <james.moger@gitblit.com>2014-03-08 19:10:53 -0500
committerJames Moger <james.moger@gitblit.com>2014-04-10 18:58:07 -0400
commit85fbc79605d886b2b4ec02aa8cfb5b8b05436576 (patch)
tree008472f57ad3b76c3dbb2b04fbf236c49316cab3
parent31f477050f223b975bce4862a6aa415ee3045857 (diff)
downloadgitblit-85fbc79605d886b2b4ec02aa8cfb5b8b05436576.tar.gz
gitblit-85fbc79605d886b2b4ec02aa8cfb5b8b05436576.zip
Authenticate SSH upload pack
-rw-r--r--src/main/java/com/gitblit/git/GitblitUploadPackFactory.java8
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);