summaryrefslogtreecommitdiffstats
path: root/src/main/java/com/gitblit/git
diff options
context:
space:
mode:
authorJames Moger <james.moger@gitblit.com>2014-03-14 12:43:55 -0400
committerJames Moger <james.moger@gitblit.com>2014-04-10 18:58:08 -0400
commita8dd379bc357c64d1128bc6790e681e27387dbee (patch)
treec5556f7390cb986712aff9e1c9371242681b366c /src/main/java/com/gitblit/git
parent44e2ee1d05a9d455ae60dd64058b31f006d551b7 (diff)
downloadgitblit-a8dd379bc357c64d1128bc6790e681e27387dbee.tar.gz
gitblit-a8dd379bc357c64d1128bc6790e681e27387dbee.zip
Rename & simplify SshSession->SshDaemonClient
Diffstat (limited to 'src/main/java/com/gitblit/git')
-rw-r--r--src/main/java/com/gitblit/git/GitblitReceivePackFactory.java9
-rw-r--r--src/main/java/com/gitblit/git/RepositoryResolver.java22
2 files changed, 15 insertions, 16 deletions
diff --git a/src/main/java/com/gitblit/git/GitblitReceivePackFactory.java b/src/main/java/com/gitblit/git/GitblitReceivePackFactory.java
index b928d851..41e348ba 100644
--- a/src/main/java/com/gitblit/git/GitblitReceivePackFactory.java
+++ b/src/main/java/com/gitblit/git/GitblitReceivePackFactory.java
@@ -32,7 +32,7 @@ import com.gitblit.manager.IGitblit;
import com.gitblit.models.RepositoryModel;
import com.gitblit.models.UserModel;
import com.gitblit.transport.git.GitDaemonClient;
-import com.gitblit.transport.ssh.SshSession;
+import com.gitblit.transport.ssh.SshDaemonClient;
import com.gitblit.utils.HttpUtils;
import com.gitblit.utils.StringUtils;
@@ -90,13 +90,12 @@ public class GitblitReceivePackFactory<X> implements ReceivePackFactory<X> {
// set timeout from Git daemon
timeout = client.getDaemon().getTimeout();
- } else if (req instanceof SshSession) {
+ } else if (req instanceof SshDaemonClient) {
// SSH request is always authenticated
- SshSession client = (SshSession) req;
+ SshDaemonClient client = (SshDaemonClient) req;
repositoryName = client.getRepositoryName();
origin = client.getRemoteAddress().toString();
- String username = client.getRemoteUser();
- user = gitblit.getUserModel(username);
+ user = client.getUser();
}
boolean allowAnonymousPushes = settings.getBoolean(Keys.git.allowAnonymousPushes, false);
diff --git a/src/main/java/com/gitblit/git/RepositoryResolver.java b/src/main/java/com/gitblit/git/RepositoryResolver.java
index ad5dcf01..cc13144e 100644
--- a/src/main/java/com/gitblit/git/RepositoryResolver.java
+++ b/src/main/java/com/gitblit/git/RepositoryResolver.java
@@ -31,7 +31,7 @@ import com.gitblit.manager.IGitblit;
import com.gitblit.models.RepositoryModel;
import com.gitblit.models.UserModel;
import com.gitblit.transport.git.GitDaemonClient;
-import com.gitblit.transport.ssh.SshSession;
+import com.gitblit.transport.ssh.SshDaemonClient;
/**
* Resolves repositories and grants export access.
@@ -69,9 +69,9 @@ public class RepositoryResolver<X> extends FileResolver<X> {
// git request
GitDaemonClient client = (GitDaemonClient) req;
client.setRepositoryName(name);
- } else if (req instanceof SshSession) {
- SshSession s = (SshSession)req;
- s.setRepositoryName(name);
+ } else if (req instanceof SshDaemonClient) {
+ SshDaemonClient client = (SshDaemonClient) req;
+ client.setRepositoryName(name);
}
return repo;
}
@@ -96,17 +96,17 @@ public class RepositoryResolver<X> extends FileResolver<X> {
user = UserModel.ANONYMOUS;
} else if (req instanceof HttpServletRequest) {
// http/https request
- HttpServletRequest httpRequest = (HttpServletRequest) req;
- scheme = httpRequest.getScheme();
- origin = httpRequest.getRemoteAddr();
- user = gitblit.authenticate(httpRequest);
+ HttpServletRequest client = (HttpServletRequest) req;
+ scheme = client.getScheme();
+ origin = client.getRemoteAddr();
+ user = gitblit.authenticate(client);
if (user == null) {
user = UserModel.ANONYMOUS;
}
- } else if (req instanceof SshSession) {
+ } else if (req instanceof SshDaemonClient) {
// ssh is always authenticated
- SshSession s = (SshSession) req;
- user = gitblit.getUserModel(s.getRemoteUser());
+ SshDaemonClient client = (SshDaemonClient) req;
+ user = client.getUser();
}
if (user.canClone(model)) {