From e59b5328787b6246f6aba9ac8bf814dd1c9993af Mon Sep 17 00:00:00 2001 From: Edwin Kempin Date: Fri, 23 Aug 2013 11:26:15 +0200 Subject: [PATCH] Hide Http Password Screen if auth.gitBasicAuth = true If auth.gitBasicAuth is set to true it is the responsibility of the container hosting Gerrit to authenticate users for HTTP requests. The generated HTTP passsword stored in Gerrit is then not used anymore, hence it is not needed to show the HTTP password screen. It may rather confuse users that they can generate a password which is of no use. Change-Id: I6a4efc179b61ee384c7be74459720703a2656ce5 Signed-off-by: Edwin Kempin --- .../java/com/google/gerrit/common/data/GerritConfig.java | 9 +++++++++ .../com/google/gerrit/client/account/SettingsScreen.java | 4 +++- .../com/google/gerrit/httpd/GerritConfigProvider.java | 2 ++ 3 files changed, 14 insertions(+), 1 deletion(-) diff --git a/gerrit-common/src/main/java/com/google/gerrit/common/data/GerritConfig.java b/gerrit-common/src/main/java/com/google/gerrit/common/data/GerritConfig.java index 38901c7072..324f00b4fa 100644 --- a/gerrit-common/src/main/java/com/google/gerrit/common/data/GerritConfig.java +++ b/gerrit-common/src/main/java/com/google/gerrit/common/data/GerritConfig.java @@ -30,6 +30,7 @@ public class GerritConfig implements Cloneable { protected String loginText; protected String httpPasswordUrl; protected String reportBugUrl; + protected boolean gitBasicAuth; protected GitwebConfig gitweb; protected boolean useContributorAgreements; @@ -90,6 +91,14 @@ public class GerritConfig implements Cloneable { reportBugUrl = u; } + public boolean isGitBasicAuth() { + return gitBasicAuth; + } + + public void setGitBasicAuth(boolean gba) { + gitBasicAuth = gba; + } + public String getEditFullNameUrl() { return editFullNameUrl; } diff --git a/gerrit-gwtui/src/main/java/com/google/gerrit/client/account/SettingsScreen.java b/gerrit-gwtui/src/main/java/com/google/gerrit/client/account/SettingsScreen.java index 97b2efb6de..2c29ab2a54 100644 --- a/gerrit-gwtui/src/main/java/com/google/gerrit/client/account/SettingsScreen.java +++ b/gerrit-gwtui/src/main/java/com/google/gerrit/client/account/SettingsScreen.java @@ -29,7 +29,9 @@ public abstract class SettingsScreen extends MenuScreen { if (Gerrit.getConfig().getSshdAddress() != null) { link(Util.C.tabSshKeys(), PageLinks.SETTINGS_SSHKEYS); } - link(Util.C.tabHttpAccess(), PageLinks.SETTINGS_HTTP_PASSWORD); + if (!Gerrit.getConfig().isGitBasicAuth()) { + link(Util.C.tabHttpAccess(), PageLinks.SETTINGS_HTTP_PASSWORD); + } link(Util.C.tabWebIdentities(), PageLinks.SETTINGS_WEBIDENT); link(Util.C.tabMyGroups(), PageLinks.SETTINGS_MYGROUPS); if (Gerrit.getConfig().isUseContributorAgreements()) { diff --git a/gerrit-httpd/src/main/java/com/google/gerrit/httpd/GerritConfigProvider.java b/gerrit-httpd/src/main/java/com/google/gerrit/httpd/GerritConfigProvider.java index 2cea40d187..208d2823d8 100644 --- a/gerrit-httpd/src/main/java/com/google/gerrit/httpd/GerritConfigProvider.java +++ b/gerrit-httpd/src/main/java/com/google/gerrit/httpd/GerritConfigProvider.java @@ -131,6 +131,8 @@ class GerritConfigProvider implements Provider { config.setReportBugUrl(null); } + config.setGitBasicAuth(authConfig.isGitBasichAuth()); + final Set fields = new HashSet(); for (final Account.FieldName n : Account.FieldName.values()) { if (realm.allowsEdit(n)) {