Reintroduce Git/REST HTTP password with OAUTH

Since the merge of I26f5bcd784 the ability to use OAUTH for WebUX and
Gerrit HTTP auth for Git/REST API has been lost.

That was a useful use-case when people needed to use a random password
for batch operations using Git/HTTP or for REST API processing.

By using the same technique experimented for LDAP/HTTP authentication
it is possible to choose if Git/HTTP and REST need to be validated
against OAUTH or using the Gerrit's hashed HTTP password.

Change-Id: I1fbabc3fa11ae0cb98308592e1be09039be78ff5
This commit is contained in:
Luca Milanesio
2017-03-06 11:59:55 +00:00
parent c6fd7dea5a
commit 51edcb7755
4 changed files with 25 additions and 10 deletions

View File

@@ -14,9 +14,9 @@
package com.google.gerrit.httpd;
import static com.google.gerrit.extensions.client.AuthType.OAUTH;
import static com.google.gerrit.httpd.plugins.LfsPluginServlet.LFS_REST;
import com.google.gerrit.extensions.client.GitBasicAuthPolicy;
import com.google.gerrit.reviewdb.client.CoreDownloadSchemes;
import com.google.gerrit.server.config.AuthConfig;
import com.google.gerrit.server.config.DownloadConfig;
@@ -42,10 +42,11 @@ public class GitOverHttpModule extends ServletModule {
Class<? extends Filter> authFilter;
if (authConfig.isTrustContainerAuth()) {
authFilter = ContainerAuthFilter.class;
} else if (authConfig.getAuthType() == OAUTH) {
authFilter = ProjectOAuthFilter.class;
} else {
authFilter = ProjectBasicAuthFilter.class;
authFilter =
authConfig.getGitBasicAuthPolicy() == GitBasicAuthPolicy.OAUTH
? ProjectOAuthFilter.class
: ProjectBasicAuthFilter.class;
}
if (isHttpEnabled()) {