mirror of https://github.com/grpc/grpc-java.git
Stabilize ChannelCredentials
Some of the experimental API annotations were changed to other issues or became `@Internal` to match their related APIs. Fixes #7479
This commit is contained in:
parent
d42f3b8fcb
commit
16eb5a47ec
|
|
@ -21,7 +21,6 @@ import com.google.common.collect.ImmutableList;
|
||||||
import io.grpc.CallCredentials;
|
import io.grpc.CallCredentials;
|
||||||
import io.grpc.ChannelCredentials;
|
import io.grpc.ChannelCredentials;
|
||||||
import io.grpc.CompositeChannelCredentials;
|
import io.grpc.CompositeChannelCredentials;
|
||||||
import io.grpc.ExperimentalApi;
|
|
||||||
import io.grpc.Status;
|
import io.grpc.Status;
|
||||||
import io.grpc.alts.internal.AltsProtocolNegotiator.GoogleDefaultProtocolNegotiatorFactory;
|
import io.grpc.alts.internal.AltsProtocolNegotiator.GoogleDefaultProtocolNegotiatorFactory;
|
||||||
import io.grpc.auth.MoreCallCredentials;
|
import io.grpc.auth.MoreCallCredentials;
|
||||||
|
|
@ -37,7 +36,6 @@ import javax.net.ssl.SSLException;
|
||||||
* class sets up a secure channel using ALTS if applicable and using TLS as fallback. It is a subset
|
* class sets up a secure channel using ALTS if applicable and using TLS as fallback. It is a subset
|
||||||
* of the functionality provided by {@link GoogleDefaultChannelCredentials}.
|
* of the functionality provided by {@link GoogleDefaultChannelCredentials}.
|
||||||
*/
|
*/
|
||||||
@ExperimentalApi("https://github.com/grpc/grpc-java/issues/7479")
|
|
||||||
public final class ComputeEngineChannelCredentials {
|
public final class ComputeEngineChannelCredentials {
|
||||||
private ComputeEngineChannelCredentials() {}
|
private ComputeEngineChannelCredentials() {}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -21,7 +21,6 @@ import com.google.common.collect.ImmutableList;
|
||||||
import io.grpc.CallCredentials;
|
import io.grpc.CallCredentials;
|
||||||
import io.grpc.ChannelCredentials;
|
import io.grpc.ChannelCredentials;
|
||||||
import io.grpc.CompositeChannelCredentials;
|
import io.grpc.CompositeChannelCredentials;
|
||||||
import io.grpc.ExperimentalApi;
|
|
||||||
import io.grpc.Status;
|
import io.grpc.Status;
|
||||||
import io.grpc.alts.internal.AltsProtocolNegotiator.GoogleDefaultProtocolNegotiatorFactory;
|
import io.grpc.alts.internal.AltsProtocolNegotiator.GoogleDefaultProtocolNegotiatorFactory;
|
||||||
import io.grpc.auth.MoreCallCredentials;
|
import io.grpc.auth.MoreCallCredentials;
|
||||||
|
|
@ -37,7 +36,6 @@ import javax.net.ssl.SSLException;
|
||||||
* Credentials appropriate to contact Google services. This class sets up a secure channel using
|
* Credentials appropriate to contact Google services. This class sets up a secure channel using
|
||||||
* ALTS if applicable and uses TLS as fallback.
|
* ALTS if applicable and uses TLS as fallback.
|
||||||
*/
|
*/
|
||||||
@ExperimentalApi("https://github.com/grpc/grpc-java/issues/7479")
|
|
||||||
public final class GoogleDefaultChannelCredentials {
|
public final class GoogleDefaultChannelCredentials {
|
||||||
private GoogleDefaultChannelCredentials() {}
|
private GoogleDefaultChannelCredentials() {}
|
||||||
|
|
||||||
|
|
@ -52,7 +50,6 @@ public final class GoogleDefaultChannelCredentials {
|
||||||
try {
|
try {
|
||||||
callCredentials = MoreCallCredentials.from(GoogleCredentials.getApplicationDefault());
|
callCredentials = MoreCallCredentials.from(GoogleCredentials.getApplicationDefault());
|
||||||
} catch (IOException e) {
|
} catch (IOException e) {
|
||||||
// TODO(ejona): Should this just throw?
|
|
||||||
callCredentials = new FailingCallCredentials(
|
callCredentials = new FailingCallCredentials(
|
||||||
Status.UNAUTHENTICATED
|
Status.UNAUTHENTICATED
|
||||||
.withDescription("Failed to get Google default credentials")
|
.withDescription("Failed to get Google default credentials")
|
||||||
|
|
|
||||||
|
|
@ -34,7 +34,6 @@ package io.grpc;
|
||||||
* would only be used after {@code instanceof} checks (which must consider
|
* would only be used after {@code instanceof} checks (which must consider
|
||||||
* {@code ChoiceChannelCredentials}!).
|
* {@code ChoiceChannelCredentials}!).
|
||||||
*/
|
*/
|
||||||
@ExperimentalApi("https://github.com/grpc/grpc-java/issues/7479")
|
|
||||||
public abstract class ChannelCredentials {
|
public abstract class ChannelCredentials {
|
||||||
/**
|
/**
|
||||||
* Returns the ChannelCredentials stripped of its CallCredentials. In the future,
|
* Returns the ChannelCredentials stripped of its CallCredentials. In the future,
|
||||||
|
|
|
||||||
|
|
@ -26,7 +26,6 @@ import java.util.List;
|
||||||
* Provides a list of {@link ChannelCredentials}, where any one may be used. The credentials are in
|
* Provides a list of {@link ChannelCredentials}, where any one may be used. The credentials are in
|
||||||
* preference order.
|
* preference order.
|
||||||
*/
|
*/
|
||||||
@ExperimentalApi("https://github.com/grpc/grpc-java/issues/7479")
|
|
||||||
public final class ChoiceChannelCredentials extends ChannelCredentials {
|
public final class ChoiceChannelCredentials extends ChannelCredentials {
|
||||||
/**
|
/**
|
||||||
* Constructs with the provided {@code creds} as options, with preferred credentials first.
|
* Constructs with the provided {@code creds} as options, with preferred credentials first.
|
||||||
|
|
|
||||||
|
|
@ -23,7 +23,7 @@ import java.util.concurrent.Executor;
|
||||||
* Uses multiple {@code CallCredentials} as if they were one. If the first credential fails, the
|
* Uses multiple {@code CallCredentials} as if they were one. If the first credential fails, the
|
||||||
* second will not be used. Both must succeed to allow the RPC.
|
* second will not be used. Both must succeed to allow the RPC.
|
||||||
*/
|
*/
|
||||||
@ExperimentalApi("https://github.com/grpc/grpc-java/issues/7479")
|
@ExperimentalApi("https://github.com/grpc/grpc-java/issues/1914")
|
||||||
public final class CompositeCallCredentials extends CallCredentials {
|
public final class CompositeCallCredentials extends CallCredentials {
|
||||||
private final CallCredentials credentials1;
|
private final CallCredentials credentials1;
|
||||||
private final CallCredentials credentials2;
|
private final CallCredentials credentials2;
|
||||||
|
|
|
||||||
|
|
@ -24,7 +24,6 @@ import com.google.common.base.Preconditions;
|
||||||
* composite credential), then all of the {@code CallCredentials} should be used; one {@code
|
* composite credential), then all of the {@code CallCredentials} should be used; one {@code
|
||||||
* CallCredentials} does not override another.
|
* CallCredentials} does not override another.
|
||||||
*/
|
*/
|
||||||
@ExperimentalApi("https://github.com/grpc/grpc-java/issues/7479")
|
|
||||||
public final class CompositeChannelCredentials extends ChannelCredentials {
|
public final class CompositeChannelCredentials extends ChannelCredentials {
|
||||||
public static ChannelCredentials create(
|
public static ChannelCredentials create(
|
||||||
ChannelCredentials channelCreds, CallCredentials callCreds) {
|
ChannelCredentials channelCreds, CallCredentials callCreds) {
|
||||||
|
|
|
||||||
|
|
@ -96,7 +96,6 @@ public final class Grpc {
|
||||||
* <li>{@code "[2001:db8:85a3:8d3:1319:8a2e:370:7348]:443"}</li>
|
* <li>{@code "[2001:db8:85a3:8d3:1319:8a2e:370:7348]:443"}</li>
|
||||||
* </ul>
|
* </ul>
|
||||||
*/
|
*/
|
||||||
@ExperimentalApi("https://github.com/grpc/grpc-java/issues/7479")
|
|
||||||
public static ManagedChannelBuilder<?> newChannelBuilder(
|
public static ManagedChannelBuilder<?> newChannelBuilder(
|
||||||
String target, ChannelCredentials creds) {
|
String target, ChannelCredentials creds) {
|
||||||
return ManagedChannelRegistry.getDefaultRegistry().newChannelBuilder(target, creds);
|
return ManagedChannelRegistry.getDefaultRegistry().newChannelBuilder(target, creds);
|
||||||
|
|
@ -107,7 +106,6 @@ public final class Grpc {
|
||||||
* form an authority string and then passed to {@link #newChannelBuilder(String,
|
* form an authority string and then passed to {@link #newChannelBuilder(String,
|
||||||
* ChannelCredentials)}. IPv6 addresses are properly surrounded by square brackets ("[]").
|
* ChannelCredentials)}. IPv6 addresses are properly surrounded by square brackets ("[]").
|
||||||
*/
|
*/
|
||||||
@ExperimentalApi("https://github.com/grpc/grpc-java/issues/7479")
|
|
||||||
public static ManagedChannelBuilder<?> newChannelBuilderForAddress(
|
public static ManagedChannelBuilder<?> newChannelBuilderForAddress(
|
||||||
String host, int port, ChannelCredentials creds) {
|
String host, int port, ChannelCredentials creds) {
|
||||||
return newChannelBuilder(authorityFromHostAndPort(host, port), creds);
|
return newChannelBuilder(authorityFromHostAndPort(host, port), creds);
|
||||||
|
|
|
||||||
|
|
@ -17,7 +17,6 @@
|
||||||
package io.grpc;
|
package io.grpc;
|
||||||
|
|
||||||
/** No client identity, authentication, or encryption is to be used. */
|
/** No client identity, authentication, or encryption is to be used. */
|
||||||
@ExperimentalApi("https://github.com/grpc/grpc-java/issues/7479")
|
|
||||||
public final class InsecureChannelCredentials extends ChannelCredentials {
|
public final class InsecureChannelCredentials extends ChannelCredentials {
|
||||||
public static ChannelCredentials create() {
|
public static ChannelCredentials create() {
|
||||||
return new InsecureChannelCredentials();
|
return new InsecureChannelCredentials();
|
||||||
|
|
|
||||||
|
|
@ -34,7 +34,7 @@ import javax.annotation.concurrent.ThreadSafe;
|
||||||
*
|
*
|
||||||
* @since 1.32.0
|
* @since 1.32.0
|
||||||
*/
|
*/
|
||||||
@ExperimentalApi("https://github.com/grpc/grpc-java/issues/7479")
|
@Internal
|
||||||
@ThreadSafe
|
@ThreadSafe
|
||||||
public final class ManagedChannelRegistry {
|
public final class ManagedChannelRegistry {
|
||||||
private static final Logger logger = Logger.getLogger(ManagedChannelRegistry.class.getName());
|
private static final Logger logger = Logger.getLogger(ManagedChannelRegistry.class.getName());
|
||||||
|
|
|
||||||
|
|
@ -36,7 +36,6 @@ import javax.net.ssl.TrustManager;
|
||||||
* incomprehensible()} method. Unless overridden by a {@code Feature}, server verification should
|
* incomprehensible()} method. Unless overridden by a {@code Feature}, server verification should
|
||||||
* use customary default root certificates.
|
* use customary default root certificates.
|
||||||
*/
|
*/
|
||||||
@ExperimentalApi("https://github.com/grpc/grpc-java/issues/7479")
|
|
||||||
public final class TlsChannelCredentials extends ChannelCredentials {
|
public final class TlsChannelCredentials extends ChannelCredentials {
|
||||||
/** Use TLS with its defaults. */
|
/** Use TLS with its defaults. */
|
||||||
public static ChannelCredentials create() {
|
public static ChannelCredentials create() {
|
||||||
|
|
@ -221,7 +220,6 @@ public final class TlsChannelCredentials extends ChannelCredentials {
|
||||||
}
|
}
|
||||||
|
|
||||||
/** Builder for {@link TlsChannelCredentials}. */
|
/** Builder for {@link TlsChannelCredentials}. */
|
||||||
@ExperimentalApi("https://github.com/grpc/grpc-java/issues/7479")
|
|
||||||
public static final class Builder {
|
public static final class Builder {
|
||||||
private boolean fakeFeature;
|
private boolean fakeFeature;
|
||||||
private byte[] certificateChain;
|
private byte[] certificateChain;
|
||||||
|
|
|
||||||
|
|
@ -24,7 +24,7 @@ import io.grpc.netty.InternalNettyChannelCredentials;
|
||||||
import io.grpc.netty.InternalProtocolNegotiator;
|
import io.grpc.netty.InternalProtocolNegotiator;
|
||||||
import io.grpc.xds.internal.sds.SdsProtocolNegotiators;
|
import io.grpc.xds.internal.sds.SdsProtocolNegotiators;
|
||||||
|
|
||||||
@ExperimentalApi("https://github.com/grpc/grpc-java/issues/7479")
|
@ExperimentalApi("https://github.com/grpc/grpc-java/issues/7514")
|
||||||
public class XdsChannelCredentials {
|
public class XdsChannelCredentials {
|
||||||
private XdsChannelCredentials() {} // prevent instantiation
|
private XdsChannelCredentials() {} // prevent instantiation
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue