|
20 | 20 | import static com.google.common.base.Preconditions.checkNotNull;
|
21 | 21 |
|
22 | 22 | import com.google.common.annotations.VisibleForTesting;
|
| 23 | +import com.google.common.collect.ImmutableList; |
23 | 24 | import com.google.common.collect.ImmutableMap;
|
24 | 25 | import com.google.errorprone.annotations.concurrent.GuardedBy;
|
25 | 26 | import io.grpc.InternalServiceProviders;
|
26 |
| -import java.util.ArrayList; |
27 |
| -import java.util.Collections; |
28 | 27 | import java.util.HashMap;
|
29 | 28 | import java.util.LinkedHashSet;
|
30 | 29 | import java.util.List;
|
31 | 30 | import java.util.Map;
|
32 |
| -import java.util.logging.Level; |
33 | 31 | import java.util.logging.Logger;
|
34 | 32 | import javax.annotation.Nullable;
|
35 | 33 | import javax.annotation.concurrent.ThreadSafe;
|
@@ -109,7 +107,7 @@ public static synchronized XdsCredentialsRegistry getDefaultRegistry() {
|
109 | 107 | if (instance == null) {
|
110 | 108 | List<XdsCredentialsProvider> providerList = InternalServiceProviders.loadAll(
|
111 | 109 | XdsCredentialsProvider.class,
|
112 |
| - getHardCodedClasses(), |
| 110 | + ImmutableList.of(), |
113 | 111 | XdsCredentialsProvider.class.getClassLoader(),
|
114 | 112 | new XdsCredentialsProviderPriorityAccessor());
|
115 | 113 | if (providerList.isEmpty()) {
|
@@ -147,39 +145,6 @@ public synchronized XdsCredentialsProvider getProvider(String name) {
|
147 | 145 | return effectiveProviders.get(checkNotNull(name, "name"));
|
148 | 146 | }
|
149 | 147 |
|
150 |
| - @VisibleForTesting |
151 |
| - static List<Class<?>> getHardCodedClasses() { |
152 |
| - // Class.forName(String) is used to remove the need for ProGuard configuration. Note that |
153 |
| - // ProGuard does not detect usages of Class.forName(String, boolean, ClassLoader): |
154 |
| - // https://sourceforge.net/p/proguard/bugs/418/ |
155 |
| - ArrayList<Class<?>> list = new ArrayList<>(); |
156 |
| - try { |
157 |
| - list.add(Class.forName("io.grpc.xds.internal.GoogleDefaultXdsCredentialsProvider")); |
158 |
| - } catch (ClassNotFoundException e) { |
159 |
| - logger.log(Level.WARNING, "Unable to find GoogleDefaultXdsCredentialsProvider", e); |
160 |
| - } |
161 |
| - |
162 |
| - try { |
163 |
| - list.add(Class.forName("io.grpc.xds.internal.InsecureXdsCredentialsProvider")); |
164 |
| - } catch (ClassNotFoundException e) { |
165 |
| - logger.log(Level.WARNING, "Unable to find InsecureXdsCredentialsProvider", e); |
166 |
| - } |
167 |
| - |
168 |
| - try { |
169 |
| - list.add(Class.forName("io.grpc.xds.internal.TlsXdsCredentialsProvider")); |
170 |
| - } catch (ClassNotFoundException e) { |
171 |
| - logger.log(Level.WARNING, "Unable to find TlsXdsCredentialsProvider", e); |
172 |
| - } |
173 |
| - |
174 |
| - try { |
175 |
| - list.add(Class.forName("io.grpc.xds.internal.JwtTokenFileXdsCredentialsProvider")); |
176 |
| - } catch (ClassNotFoundException e) { |
177 |
| - logger.log(Level.WARNING, "Unable to find JwtTokenFileXdsCredentialsProvider", e); |
178 |
| - } |
179 |
| - |
180 |
| - return Collections.unmodifiableList(list); |
181 |
| - } |
182 |
| - |
183 | 148 | private static final class XdsCredentialsProviderPriorityAccessor
|
184 | 149 | implements InternalServiceProviders.PriorityAccessor<XdsCredentialsProvider> {
|
185 | 150 | @Override
|
|
0 commit comments