Rename LoginType to AuthType
Better matches with the configuration file name, which is what a developer coming from an administrator's point of view would think. Signed-off-by: Shawn O. Pearce <sop@google.com>
This commit is contained in:
@@ -312,7 +312,7 @@ public class Gerrit implements EntryPoint {
|
|||||||
addLink(menuRight, C.menuSettings(), Link.SETTINGS);
|
addLink(menuRight, C.menuSettings(), Link.SETTINGS);
|
||||||
menuRight.add(anchor(C.menuSignOut(), "logout"));
|
menuRight.add(anchor(C.menuSignOut(), "logout"));
|
||||||
} else {
|
} else {
|
||||||
switch (getConfig().getLoginType()) {
|
switch (getConfig().getAuthType()) {
|
||||||
case HTTP:
|
case HTTP:
|
||||||
case HTTP_LDAP:
|
case HTTP_LDAP:
|
||||||
break;
|
break;
|
||||||
|
|||||||
@@ -71,7 +71,7 @@ public class SignInDialog extends AutoCenterDialogBox {
|
|||||||
public SignInDialog(final Mode signInMode, final String errorMsg) {
|
public SignInDialog(final Mode signInMode, final String errorMsg) {
|
||||||
super(/* auto hide */true, /* modal */true);
|
super(/* auto hide */true, /* modal */true);
|
||||||
|
|
||||||
switch (Gerrit.getConfig().getLoginType()) {
|
switch (Gerrit.getConfig().getAuthType()) {
|
||||||
case OPENID:
|
case OPENID:
|
||||||
panel = new OpenIdLoginPanel(signInMode, errorMsg);
|
panel = new OpenIdLoginPanel(signInMode, errorMsg);
|
||||||
break;
|
break;
|
||||||
|
|||||||
@@ -54,7 +54,7 @@ class ExternalIdPanel extends Composite {
|
|||||||
});
|
});
|
||||||
body.add(deleteIdentity);
|
body.add(deleteIdentity);
|
||||||
|
|
||||||
switch (Gerrit.getConfig().getLoginType()) {
|
switch (Gerrit.getConfig().getAuthType()) {
|
||||||
case OPENID: {
|
case OPENID: {
|
||||||
final Button linkIdentity = new Button(Util.C.buttonLinkIdentity());
|
final Button linkIdentity = new Button(Util.C.buttonLinkIdentity());
|
||||||
linkIdentity.addClickHandler(new ClickHandler() {
|
linkIdentity.addClickHandler(new ClickHandler() {
|
||||||
|
|||||||
@@ -14,7 +14,7 @@
|
|||||||
|
|
||||||
package com.google.gerrit.client.data;
|
package com.google.gerrit.client.data;
|
||||||
|
|
||||||
import com.google.gerrit.client.reviewdb.LoginType;
|
import com.google.gerrit.client.reviewdb.AuthType;
|
||||||
import com.google.gerrit.client.reviewdb.Project;
|
import com.google.gerrit.client.reviewdb.Project;
|
||||||
|
|
||||||
public class GerritConfig implements Cloneable {
|
public class GerritConfig implements Cloneable {
|
||||||
@@ -23,7 +23,7 @@ public class GerritConfig implements Cloneable {
|
|||||||
protected boolean useContributorAgreements;
|
protected boolean useContributorAgreements;
|
||||||
protected boolean useContactInfo;
|
protected boolean useContactInfo;
|
||||||
protected boolean allowRegisterNewEmail;
|
protected boolean allowRegisterNewEmail;
|
||||||
protected LoginType loginType;
|
protected AuthType authType;
|
||||||
protected boolean useRepoDownload;
|
protected boolean useRepoDownload;
|
||||||
protected String gitDaemonUrl;
|
protected String gitDaemonUrl;
|
||||||
protected String sshdAddress;
|
protected String sshdAddress;
|
||||||
@@ -38,12 +38,12 @@ public class GerritConfig implements Cloneable {
|
|||||||
canonicalUrl = u;
|
canonicalUrl = u;
|
||||||
}
|
}
|
||||||
|
|
||||||
public LoginType getLoginType() {
|
public AuthType getAuthType() {
|
||||||
return loginType;
|
return authType;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setLoginType(final LoginType t) {
|
public void setAuthType(final AuthType t) {
|
||||||
loginType = t;
|
authType = t;
|
||||||
}
|
}
|
||||||
|
|
||||||
public GitwebLink getGitwebLink() {
|
public GitwebLink getGitwebLink() {
|
||||||
|
|||||||
@@ -14,7 +14,7 @@
|
|||||||
|
|
||||||
package com.google.gerrit.client.reviewdb;
|
package com.google.gerrit.client.reviewdb;
|
||||||
|
|
||||||
public enum LoginType {
|
public enum AuthType {
|
||||||
/** Login relies upon the OpenID standard: {@link "http://openid.net/"} */
|
/** Login relies upon the OpenID standard: {@link "http://openid.net/"} */
|
||||||
OPENID,
|
OPENID,
|
||||||
|
|
||||||
@@ -16,7 +16,7 @@ package com.google.gerrit.server.config;
|
|||||||
|
|
||||||
import com.google.gerrit.client.reviewdb.AccountExternalId;
|
import com.google.gerrit.client.reviewdb.AccountExternalId;
|
||||||
import com.google.gerrit.client.reviewdb.AccountGroup;
|
import com.google.gerrit.client.reviewdb.AccountGroup;
|
||||||
import com.google.gerrit.client.reviewdb.LoginType;
|
import com.google.gerrit.client.reviewdb.AuthType;
|
||||||
import com.google.gerrit.client.reviewdb.SystemConfig;
|
import com.google.gerrit.client.reviewdb.SystemConfig;
|
||||||
import com.google.gwtjsonrpc.server.SignedToken;
|
import com.google.gwtjsonrpc.server.SignedToken;
|
||||||
import com.google.gwtjsonrpc.server.XsrfException;
|
import com.google.gwtjsonrpc.server.XsrfException;
|
||||||
@@ -33,7 +33,7 @@ import java.util.Set;
|
|||||||
/** Authentication related settings from {@code gerrit.config}. */
|
/** Authentication related settings from {@code gerrit.config}. */
|
||||||
@Singleton
|
@Singleton
|
||||||
public class AuthConfig {
|
public class AuthConfig {
|
||||||
private final LoginType loginType;
|
private final AuthType loginType;
|
||||||
private final String httpHeader;
|
private final String httpHeader;
|
||||||
private final String logoutUrl;
|
private final String logoutUrl;
|
||||||
private final String[] trusted;
|
private final String[] trusted;
|
||||||
@@ -73,11 +73,11 @@ public class AuthConfig {
|
|||||||
return r;
|
return r;
|
||||||
}
|
}
|
||||||
|
|
||||||
private static LoginType toType(final Config cfg) {
|
private static AuthType toType(final Config cfg) {
|
||||||
if (isBecomeAnyoneEnabled()) {
|
if (isBecomeAnyoneEnabled()) {
|
||||||
return LoginType.DEVELOPMENT_BECOME_ANY_ACCOUNT;
|
return AuthType.DEVELOPMENT_BECOME_ANY_ACCOUNT;
|
||||||
}
|
}
|
||||||
return ConfigUtil.getEnum(cfg, "auth", null, "type", LoginType.OPENID);
|
return ConfigUtil.getEnum(cfg, "auth", null, "type", AuthType.OPENID);
|
||||||
}
|
}
|
||||||
|
|
||||||
private static boolean isBecomeAnyoneEnabled() {
|
private static boolean isBecomeAnyoneEnabled() {
|
||||||
@@ -90,7 +90,7 @@ public class AuthConfig {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/** Type of user authentication used by this Gerrit server. */
|
/** Type of user authentication used by this Gerrit server. */
|
||||||
public LoginType getLoginType() {
|
public AuthType getLoginType() {
|
||||||
return loginType;
|
return loginType;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -18,7 +18,7 @@ import static com.google.inject.Scopes.SINGLETON;
|
|||||||
import static com.google.inject.Stage.PRODUCTION;
|
import static com.google.inject.Stage.PRODUCTION;
|
||||||
|
|
||||||
import com.google.gerrit.client.data.ApprovalTypes;
|
import com.google.gerrit.client.data.ApprovalTypes;
|
||||||
import com.google.gerrit.client.reviewdb.LoginType;
|
import com.google.gerrit.client.reviewdb.AuthType;
|
||||||
import com.google.gerrit.git.ChangeMergeQueue;
|
import com.google.gerrit.git.ChangeMergeQueue;
|
||||||
import com.google.gerrit.git.MergeOp;
|
import com.google.gerrit.git.MergeOp;
|
||||||
import com.google.gerrit.git.MergeQueue;
|
import com.google.gerrit.git.MergeQueue;
|
||||||
@@ -81,7 +81,7 @@ public class GerritGlobalModule extends FactoryModule {
|
|||||||
return cfg.createChildInjector(modules);
|
return cfg.createChildInjector(modules);
|
||||||
}
|
}
|
||||||
|
|
||||||
private final LoginType loginType;
|
private final AuthType loginType;
|
||||||
|
|
||||||
@Inject
|
@Inject
|
||||||
GerritGlobalModule(final AuthConfig authConfig,
|
GerritGlobalModule(final AuthConfig authConfig,
|
||||||
|
|||||||
@@ -81,7 +81,7 @@ public class GerritConfigProvider implements Provider<GerritConfig> {
|
|||||||
config.setUseContactInfo(contactStore != null && contactStore.isEnabled());
|
config.setUseContactInfo(contactStore != null && contactStore.isEnabled());
|
||||||
config.setAllowRegisterNewEmail(emailSender != null
|
config.setAllowRegisterNewEmail(emailSender != null
|
||||||
&& emailSender.isEnabled());
|
&& emailSender.isEnabled());
|
||||||
config.setLoginType(authConfig.getLoginType());
|
config.setAuthType(authConfig.getLoginType());
|
||||||
config.setWildProject(wildProject);
|
config.setWildProject(wildProject);
|
||||||
config.setApprovalTypes(approvalTypes);
|
config.setApprovalTypes(approvalTypes);
|
||||||
|
|
||||||
|
|||||||
@@ -17,7 +17,7 @@ package com.google.gerrit.server.http;
|
|||||||
import static com.google.inject.Scopes.SINGLETON;
|
import static com.google.inject.Scopes.SINGLETON;
|
||||||
|
|
||||||
import com.google.gerrit.client.data.GerritConfig;
|
import com.google.gerrit.client.data.GerritConfig;
|
||||||
import com.google.gerrit.client.reviewdb.LoginType;
|
import com.google.gerrit.client.reviewdb.AuthType;
|
||||||
import com.google.gerrit.server.CurrentUser;
|
import com.google.gerrit.server.CurrentUser;
|
||||||
import com.google.gerrit.server.IdentifiedUser;
|
import com.google.gerrit.server.IdentifiedUser;
|
||||||
import com.google.gerrit.server.RemotePeer;
|
import com.google.gerrit.server.RemotePeer;
|
||||||
@@ -42,14 +42,14 @@ import java.net.SocketAddress;
|
|||||||
|
|
||||||
class WebModule extends FactoryModule {
|
class WebModule extends FactoryModule {
|
||||||
private final Provider<SshInfo> sshInfoProvider;
|
private final Provider<SshInfo> sshInfoProvider;
|
||||||
private final LoginType loginType;
|
private final AuthType loginType;
|
||||||
|
|
||||||
@Inject
|
@Inject
|
||||||
WebModule(final Provider<SshInfo> sshInfoProvider, final AuthConfig authConfig) {
|
WebModule(final Provider<SshInfo> sshInfoProvider, final AuthConfig authConfig) {
|
||||||
this(sshInfoProvider, authConfig.getLoginType());
|
this(sshInfoProvider, authConfig.getLoginType());
|
||||||
}
|
}
|
||||||
|
|
||||||
WebModule(final Provider<SshInfo> sshInfoProvider, final LoginType loginType) {
|
WebModule(final Provider<SshInfo> sshInfoProvider, final AuthType loginType) {
|
||||||
this.sshInfoProvider = sshInfoProvider;
|
this.sshInfoProvider = sshInfoProvider;
|
||||||
this.loginType = loginType;
|
this.loginType = loginType;
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user