summaryrefslogtreecommitdiffstats
path: root/gerrit-httpd/src/main/java/com/google/gerrit/httpd/WebModule.java
diff options
context:
space:
mode:
Diffstat (limited to 'gerrit-httpd/src/main/java/com/google/gerrit/httpd/WebModule.java')
-rw-r--r--gerrit-httpd/src/main/java/com/google/gerrit/httpd/WebModule.java45
1 files changed, 15 insertions, 30 deletions
diff --git a/gerrit-httpd/src/main/java/com/google/gerrit/httpd/WebModule.java b/gerrit-httpd/src/main/java/com/google/gerrit/httpd/WebModule.java
index cc2e144742..8ee2c41447 100644
--- a/gerrit-httpd/src/main/java/com/google/gerrit/httpd/WebModule.java
+++ b/gerrit-httpd/src/main/java/com/google/gerrit/httpd/WebModule.java
@@ -21,10 +21,8 @@ import com.google.gerrit.httpd.auth.become.BecomeAnyAccountLoginServlet;
import com.google.gerrit.httpd.auth.container.HttpAuthModule;
import com.google.gerrit.httpd.auth.container.HttpsClientSslCertModule;
import com.google.gerrit.httpd.auth.ldap.LdapAuthModule;
-import com.google.gerrit.httpd.auth.openid.OpenIdModule;
import com.google.gerrit.httpd.gitweb.GitWebModule;
import com.google.gerrit.httpd.rpc.UiRpcModule;
-import com.google.gerrit.reviewdb.AuthType;
import com.google.gerrit.server.CurrentUser;
import com.google.gerrit.server.IdentifiedUser;
import com.google.gerrit.server.RemotePeer;
@@ -38,12 +36,11 @@ import com.google.gerrit.server.config.FactoryModule;
import com.google.gerrit.server.config.GerritRequestModule;
import com.google.gerrit.server.contact.ContactStore;
import com.google.gerrit.server.contact.ContactStoreProvider;
-import com.google.gerrit.server.ssh.SshInfo;
-import com.google.gerrit.server.ssh.SshKeyCache;
+import com.google.gerrit.server.util.GuiceRequestScopePropagator;
+import com.google.gerrit.server.util.RequestScopePropagator;
import com.google.inject.AbstractModule;
import com.google.inject.Inject;
import com.google.inject.Injector;
-import com.google.inject.Provider;
import com.google.inject.ProvisionException;
import com.google.inject.servlet.RequestScoped;
import com.google.inject.servlet.ServletModule;
@@ -53,21 +50,15 @@ import java.net.SocketAddress;
import javax.annotation.Nullable;
public class WebModule extends FactoryModule {
- private final Provider<SshInfo> sshInfoProvider;
- private final Provider<SshKeyCache> sshKeyCacheProvider;
- private final AuthType authType;
+ private final AuthConfig authConfig;
private final boolean wantSSL;
private final GitWebConfig gitWebConfig;
@Inject
- WebModule(final Provider<SshInfo> sshInfoProvider,
- final Provider<SshKeyCache> sshKeyCacheProvider,
- final AuthConfig authConfig,
+ WebModule(final AuthConfig authConfig,
@CanonicalWebUrl @Nullable final String canonicalUrl,
final Injector creatingInjector) {
- this.sshInfoProvider = sshInfoProvider;
- this.sshKeyCacheProvider = sshKeyCacheProvider;
- this.authType = authConfig.getAuthType();
+ this.authConfig = authConfig;
this.wantSSL = canonicalUrl != null && canonicalUrl.startsWith("https:");
this.gitWebConfig =
@@ -87,16 +78,13 @@ public class WebModule extends FactoryModule {
filter("/*").through(RequestCleanupFilter.class);
}
});
+ bind(RequestScopePropagator.class).to(GuiceRequestScopePropagator.class);
if (wantSSL) {
install(new RequireSslFilter.Module());
}
- switch (authType) {
- case OPENID:
- install(new OpenIdModule());
- break;
-
+ switch (authConfig.getAuthType()) {
case HTTP:
case HTTP_LDAP:
install(new HttpAuthModule());
@@ -120,17 +108,18 @@ public class WebModule extends FactoryModule {
});
break;
+ case OPENID:
+ // OpenID support is bound in WebAppInitializer and Daemon.
+ case CUSTOM_EXTENSION:
+ break;
default:
- throw new ProvisionException("Unsupported loginType: " + authType);
+ throw new ProvisionException("Unsupported loginType: " + authConfig.getAuthType());
}
install(new UrlModule());
install(new UiRpcModule());
install(new GerritRequestModule());
- install(new ProjectServlet.Module());
-
- bind(SshInfo.class).toProvider(sshInfoProvider);
- bind(SshKeyCache.class).toProvider(sshKeyCacheProvider);
+ install(new GitOverHttpServlet.Module());
bind(GitWebConfig.class).toInstance(gitWebConfig);
if (gitWebConfig.getGitwebCGI() != null) {
@@ -151,11 +140,7 @@ public class WebModule extends FactoryModule {
bind(SocketAddress.class).annotatedWith(RemotePeer.class).toProvider(
HttpRemotePeerProvider.class).in(RequestScoped.class);
- install(WebSession.module());
-
- bind(CurrentUser.class).toProvider(HttpCurrentUserProvider.class).in(
- RequestScoped.class);
- bind(IdentifiedUser.class).toProvider(HttpIdentifiedUserProvider.class).in(
- RequestScoped.class);
+ bind(CurrentUser.class).toProvider(HttpCurrentUserProvider.class);
+ bind(IdentifiedUser.class).toProvider(HttpIdentifiedUserProvider.class);
}
}