use of com.google.gerrit.extensions.common.AuthInfo in project gerrit by GerritCodeReview.
the class GetServerInfo method getAuthInfo.
private AuthInfo getAuthInfo(AuthConfig cfg, Realm realm) {
AuthInfo info = new AuthInfo();
info.authType = cfg.getAuthType();
info.useContributorAgreements = toBoolean(cfg.isUseContributorAgreements());
info.editableAccountFields = new ArrayList<>(realm.getEditableFields());
info.switchAccountUrl = cfg.getSwitchAccountUrl();
info.gitBasicAuthPolicy = cfg.getGitBasicAuthPolicy();
if (info.useContributorAgreements != null) {
Collection<ContributorAgreement> agreements = projectCache.getAllProjects().getConfig().getContributorAgreements();
if (!agreements.isEmpty()) {
info.contributorAgreements = Lists.newArrayListWithCapacity(agreements.size());
for (ContributorAgreement agreement : agreements) {
info.contributorAgreements.add(agreementJson.format(agreement));
}
}
}
switch(info.authType) {
case LDAP:
case LDAP_BIND:
info.registerUrl = cfg.getRegisterUrl();
info.registerText = cfg.getRegisterText();
info.editFullNameUrl = cfg.getEditFullNameUrl();
break;
case CUSTOM_EXTENSION:
info.registerUrl = cfg.getRegisterUrl();
info.registerText = cfg.getRegisterText();
info.editFullNameUrl = cfg.getEditFullNameUrl();
info.httpPasswordUrl = cfg.getHttpPasswordUrl();
break;
case HTTP:
case HTTP_LDAP:
info.loginUrl = cfg.getLoginUrl();
info.loginText = cfg.getLoginText();
break;
case CLIENT_SSL_CERT_LDAP:
case DEVELOPMENT_BECOME_ANY_ACCOUNT:
case OAUTH:
case OPENID:
case OPENID_SSO:
break;
}
return info;
}
Aggregations