Line data Source code
1 : // Copyright (C) 2016 The Android Open Source Project 2 : // 3 : // Licensed under the Apache License, Version 2.0 (the "License"); 4 : // you may not use this file except in compliance with the License. 5 : // You may obtain a copy of the License at 6 : // 7 : // http://www.apache.org/licenses/LICENSE-2.0 8 : // 9 : // Unless required by applicable law or agreed to in writing, software 10 : // distributed under the License is distributed on an "AS IS" BASIS, 11 : // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 : // See the License for the specific language governing permissions and 13 : // limitations under the License. 14 : 15 : package com.google.gerrit.extensions.common; 16 : 17 : import com.google.gerrit.extensions.client.AccountFieldName; 18 : import com.google.gerrit.extensions.client.AuthType; 19 : import com.google.gerrit.extensions.client.GitBasicAuthPolicy; 20 : import java.util.List; 21 : 22 : /** 23 : * Representation of auth-related server configuration in the REST API. 24 : * 25 : * <p>This class determines the JSON format of auth-related server configuration in the REST API. 26 : * 27 : * <p>The contained values come from the {@code auth} section of {@code gerrit.config}. 28 : */ 29 3 : public class AuthInfo { 30 : /** 31 : * The authentication type that is configured on the server. 32 : * 33 : * <p>The value of the {@code auth.type} parameter in {@code gerrit.config}. 34 : */ 35 : public AuthType authType; 36 : 37 : /** 38 : * Whether contributor agreements are required. 39 : * 40 : * <p>The value of the {@code auth.contributorAgreements} parameter in {@code gerrit.config}. 41 : */ 42 : public Boolean useContributorAgreements; 43 : 44 : /** List of contributor agreements that have been configured on the server. */ 45 : public List<AgreementInfo> contributorAgreements; 46 : 47 : /** List of account fields that are editable. */ 48 : public List<AccountFieldName> editableAccountFields; 49 : 50 : /** 51 : * The login URL. 52 : * 53 : * <p>The value of the {@code auth.loginUrl} parameter in {@code gerrit.config}. 54 : * 55 : * <p>Only set if authentication type is {@code HTTP} or {@code HTTP_LDAP}. 56 : */ 57 : public String loginUrl; 58 : 59 : /** 60 : * The login text. 61 : * 62 : * <p>The value of the {@code auth.loginText} parameter in {@code gerrit.config}. 63 : * 64 : * <p>Only set if authentication type is {@code HTTP} or {@code HTTP_LDAP}. 65 : */ 66 : public String loginText; 67 : 68 : /** 69 : * The URL to switch accounts. 70 : * 71 : * <p>The value of the {@code auth.switchAccountUrl} parameter in {@code gerrit.config}. 72 : */ 73 : public String switchAccountUrl; 74 : 75 : /** 76 : * The register URL. 77 : * 78 : * <p>The value of the {@code auth.registerUrl} parameter in {@code gerrit.config}. 79 : * 80 : * <p>Only set if authentication type is {@code LDAP}, {@code LDAP_BIND} or {@code 81 : * CUSTOM_EXTENSION}. 82 : */ 83 : public String registerUrl; 84 : 85 : /** 86 : * The register text. 87 : * 88 : * <p>The value of the {@code auth.registerText} parameter in {@code gerrit.config}. 89 : * 90 : * <p>Only set if authentication type is {@code LDAP}, {@code LDAP_BIND} or {@code 91 : * CUSTOM_EXTENSION}. 92 : */ 93 : public String registerText; 94 : 95 : /** 96 : * The URL to edit the full name. 97 : * 98 : * <p>The value of the {@code auth.editFullNameUrl} parameter in {@code gerrit.config}. 99 : * 100 : * <p>Only set if authentication type is {@code LDAP}, {@code LDAP_BIND} or {@code 101 : * CUSTOM_EXTENSION}. 102 : */ 103 : public String editFullNameUrl; 104 : 105 : /** 106 : * The URL to obtain an HTTP password. 107 : * 108 : * <p>The value of the {@code auth.httpPasswordUrl} parameter in {@code gerrit.config}. 109 : * 110 : * <p>Only set if authentication type is {@code CUSTOM_EXTENSION}. 111 : */ 112 : public String httpPasswordUrl; 113 : 114 : /** 115 : * The policy to authenticate Git over HTTP and REST API requests. 116 : * 117 : * <p>The value of the {@code auth.gitBasicAuthPolicy} parameter in {@code gerrit.config}. 118 : * 119 : * <p>Only set if authentication type is {@code LDAP}, {@code LDAP_BIND} or {@code OAUTH}. 120 : */ 121 : public GitBasicAuthPolicy gitBasicAuthPolicy; 122 : }