Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

s2a: Move s2a implementation to internal package. #11541

Draft
wants to merge 1 commit into
base: master
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package io.grpc.s2a.handshaker;
package io.grpc.s2a.internal.handshaker;

import static io.grpc.MethodDescriptor.generateFullMethodName;

Expand All @@ -15,29 +15,29 @@ private S2AServiceGrpc() {}
public static final java.lang.String SERVICE_NAME = "grpc.gcp.s2a.S2AService";

// Static method descriptors that strictly reflect the proto.
private static volatile io.grpc.MethodDescriptor<io.grpc.s2a.handshaker.SessionReq,
io.grpc.s2a.handshaker.SessionResp> getSetUpSessionMethod;
private static volatile io.grpc.MethodDescriptor<io.grpc.s2a.internal.handshaker.SessionReq,
io.grpc.s2a.internal.handshaker.SessionResp> getSetUpSessionMethod;

@io.grpc.stub.annotations.RpcMethod(
fullMethodName = SERVICE_NAME + '/' + "SetUpSession",
requestType = io.grpc.s2a.handshaker.SessionReq.class,
responseType = io.grpc.s2a.handshaker.SessionResp.class,
requestType = io.grpc.s2a.internal.handshaker.SessionReq.class,
responseType = io.grpc.s2a.internal.handshaker.SessionResp.class,
methodType = io.grpc.MethodDescriptor.MethodType.BIDI_STREAMING)
public static io.grpc.MethodDescriptor<io.grpc.s2a.handshaker.SessionReq,
io.grpc.s2a.handshaker.SessionResp> getSetUpSessionMethod() {
io.grpc.MethodDescriptor<io.grpc.s2a.handshaker.SessionReq, io.grpc.s2a.handshaker.SessionResp> getSetUpSessionMethod;
public static io.grpc.MethodDescriptor<io.grpc.s2a.internal.handshaker.SessionReq,
io.grpc.s2a.internal.handshaker.SessionResp> getSetUpSessionMethod() {
io.grpc.MethodDescriptor<io.grpc.s2a.internal.handshaker.SessionReq, io.grpc.s2a.internal.handshaker.SessionResp> getSetUpSessionMethod;
if ((getSetUpSessionMethod = S2AServiceGrpc.getSetUpSessionMethod) == null) {
synchronized (S2AServiceGrpc.class) {
if ((getSetUpSessionMethod = S2AServiceGrpc.getSetUpSessionMethod) == null) {
S2AServiceGrpc.getSetUpSessionMethod = getSetUpSessionMethod =
io.grpc.MethodDescriptor.<io.grpc.s2a.handshaker.SessionReq, io.grpc.s2a.handshaker.SessionResp>newBuilder()
io.grpc.MethodDescriptor.<io.grpc.s2a.internal.handshaker.SessionReq, io.grpc.s2a.internal.handshaker.SessionResp>newBuilder()
.setType(io.grpc.MethodDescriptor.MethodType.BIDI_STREAMING)
.setFullMethodName(generateFullMethodName(SERVICE_NAME, "SetUpSession"))
.setSampledToLocalTracing(true)
.setRequestMarshaller(io.grpc.protobuf.ProtoUtils.marshaller(
io.grpc.s2a.handshaker.SessionReq.getDefaultInstance()))
io.grpc.s2a.internal.handshaker.SessionReq.getDefaultInstance()))
.setResponseMarshaller(io.grpc.protobuf.ProtoUtils.marshaller(
io.grpc.s2a.handshaker.SessionResp.getDefaultInstance()))
io.grpc.s2a.internal.handshaker.SessionResp.getDefaultInstance()))
.setSchemaDescriptor(new S2AServiceMethodDescriptorSupplier("SetUpSession"))
.build();
}
Expand Down Expand Up @@ -100,8 +100,8 @@ public interface AsyncService {
* operations from the TLS handshake.
* </pre>
*/
default io.grpc.stub.StreamObserver<io.grpc.s2a.handshaker.SessionReq> setUpSession(
io.grpc.stub.StreamObserver<io.grpc.s2a.handshaker.SessionResp> responseObserver) {
default io.grpc.stub.StreamObserver<io.grpc.s2a.internal.handshaker.SessionReq> setUpSession(
io.grpc.stub.StreamObserver<io.grpc.s2a.internal.handshaker.SessionResp> responseObserver) {
return io.grpc.stub.ServerCalls.asyncUnimplementedStreamingCall(getSetUpSessionMethod(), responseObserver);
}
}
Expand Down Expand Up @@ -139,8 +139,8 @@ protected S2AServiceStub build(
* operations from the TLS handshake.
* </pre>
*/
public io.grpc.stub.StreamObserver<io.grpc.s2a.handshaker.SessionReq> setUpSession(
io.grpc.stub.StreamObserver<io.grpc.s2a.handshaker.SessionResp> responseObserver) {
public io.grpc.stub.StreamObserver<io.grpc.s2a.internal.handshaker.SessionReq> setUpSession(
io.grpc.stub.StreamObserver<io.grpc.s2a.internal.handshaker.SessionResp> responseObserver) {
return io.grpc.stub.ClientCalls.asyncBidiStreamingCall(
getChannel().newCall(getSetUpSessionMethod(), getCallOptions()), responseObserver);
}
Expand Down Expand Up @@ -211,7 +211,7 @@ public io.grpc.stub.StreamObserver<Req> invoke(
switch (methodId) {
case METHODID_SET_UP_SESSION:
return (io.grpc.stub.StreamObserver<Req>) serviceImpl.setUpSession(
(io.grpc.stub.StreamObserver<io.grpc.s2a.handshaker.SessionResp>) responseObserver);
(io.grpc.stub.StreamObserver<io.grpc.s2a.internal.handshaker.SessionResp>) responseObserver);
default:
throw new AssertionError();
}
Expand All @@ -224,8 +224,8 @@ public static final io.grpc.ServerServiceDefinition bindService(AsyncService ser
getSetUpSessionMethod(),
io.grpc.stub.ServerCalls.asyncBidiStreamingCall(
new MethodHandlers<
io.grpc.s2a.handshaker.SessionReq,
io.grpc.s2a.handshaker.SessionResp>(
io.grpc.s2a.internal.handshaker.SessionReq,
io.grpc.s2a.internal.handshaker.SessionResp>(
service, METHODID_SET_UP_SESSION)))
.build();
}
Expand All @@ -236,7 +236,7 @@ private static abstract class S2AServiceBaseDescriptorSupplier

@java.lang.Override
public com.google.protobuf.Descriptors.FileDescriptor getFileDescriptor() {
return io.grpc.s2a.handshaker.S2AProto.getDescriptor();
return io.grpc.s2a.internal.handshaker.S2AProto.getDescriptor();
}

@java.lang.Override
Expand Down
6 changes: 3 additions & 3 deletions s2a/src/main/java/io/grpc/s2a/S2AChannelCredentials.java
Original file line number Diff line number Diff line change
Expand Up @@ -28,9 +28,9 @@
import io.grpc.internal.SharedResourcePool;
import io.grpc.netty.InternalNettyChannelCredentials;
import io.grpc.netty.InternalProtocolNegotiator;
import io.grpc.s2a.channel.S2AHandshakerServiceChannel;
import io.grpc.s2a.handshaker.S2AIdentity;
import io.grpc.s2a.handshaker.S2AProtocolNegotiatorFactory;
import io.grpc.s2a.internal.channel.S2AHandshakerServiceChannel;
import io.grpc.s2a.internal.handshaker.S2AIdentity;
import io.grpc.s2a.internal.handshaker.S2AProtocolNegotiatorFactory;
import java.util.Optional;
import javax.annotation.concurrent.NotThreadSafe;
import org.checkerframework.checker.nullness.qual.Nullable;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
* limitations under the License.
*/

package io.grpc.s2a.channel;
package io.grpc.s2a.internal.channel;

import com.google.errorprone.annotations.CanIgnoreReturnValue;
import io.grpc.Channel;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
* limitations under the License.
*/

package io.grpc.s2a.channel;
package io.grpc.s2a.internal.channel;

import static com.google.common.base.Preconditions.checkArgument;
import static com.google.common.base.Preconditions.checkNotNull;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
* limitations under the License.
*/

package io.grpc.s2a.channel;
package io.grpc.s2a.internal.channel;

import static com.google.common.base.Preconditions.checkNotNull;
import static java.util.concurrent.TimeUnit.SECONDS;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
* limitations under the License.
*/

package io.grpc.s2a.handshaker;
package io.grpc.s2a.internal.handshaker;

import java.io.IOException;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,11 +14,11 @@
* limitations under the License.
*/

package io.grpc.s2a.handshaker;
package io.grpc.s2a.internal.handshaker;

import com.google.errorprone.annotations.Immutable;
import io.grpc.s2a.handshaker.S2AIdentity;
import io.grpc.s2a.handshaker.tokenmanager.AccessTokenManager;
import io.grpc.s2a.internal.handshaker.S2AIdentity;
import io.grpc.s2a.internal.handshaker.tokenmanager.AccessTokenManager;
import java.util.Optional;

/** Retrieves the authentication mechanism for a given local identity. */
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
* limitations under the License.
*/

package io.grpc.s2a.handshaker;
package io.grpc.s2a.internal.handshaker;

import com.google.common.collect.ImmutableSet;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
* limitations under the License.
*/

package io.grpc.s2a.handshaker;
package io.grpc.s2a.internal.handshaker;

/** Exception that denotes a runtime error that was encountered when talking to the S2A server. */
@SuppressWarnings("serial") // This class is never serialized.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
* limitations under the License.
*/

package io.grpc.s2a.handshaker;
package io.grpc.s2a.internal.handshaker;

import static com.google.common.base.Preconditions.checkNotNull;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,15 +14,15 @@
* limitations under the License.
*/

package io.grpc.s2a.handshaker;
package io.grpc.s2a.internal.handshaker;

import static com.google.common.base.Preconditions.checkArgument;
import static com.google.common.base.Preconditions.checkNotNull;

import com.google.common.annotations.VisibleForTesting;
import com.google.common.collect.ImmutableMap;
import com.google.protobuf.ByteString;
import io.grpc.s2a.handshaker.S2AIdentity;
import io.grpc.s2a.internal.handshaker.S2AIdentity;
import io.netty.handler.ssl.OpenSslPrivateKeyMethod;
import java.io.IOException;
import java.util.Optional;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
* limitations under the License.
*/

package io.grpc.s2a.handshaker;
package io.grpc.s2a.internal.handshaker;

import static com.google.common.base.Preconditions.checkArgument;
import static com.google.common.base.Preconditions.checkNotNull;
Expand All @@ -35,9 +35,9 @@
import io.grpc.netty.InternalProtocolNegotiator.ProtocolNegotiator;
import io.grpc.netty.InternalProtocolNegotiators;
import io.grpc.netty.InternalProtocolNegotiators.ProtocolNegotiationHandler;
import io.grpc.s2a.channel.S2AChannelPool;
import io.grpc.s2a.channel.S2AGrpcChannelPool;
import io.grpc.s2a.handshaker.S2AIdentity;
import io.grpc.s2a.internal.channel.S2AChannelPool;
import io.grpc.s2a.internal.channel.S2AGrpcChannelPool;
import io.grpc.s2a.internal.handshaker.S2AIdentity;
import io.netty.channel.ChannelHandler;
import io.netty.channel.ChannelHandlerAdapter;
import io.netty.channel.ChannelHandlerContext;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
* limitations under the License.
*/

package io.grpc.s2a.handshaker;
package io.grpc.s2a.internal.handshaker;

import static com.google.common.base.Preconditions.checkArgument;
import static com.google.common.base.Preconditions.checkNotNull;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,15 +14,15 @@
* limitations under the License.
*/

package io.grpc.s2a.handshaker;
package io.grpc.s2a.internal.handshaker;

import static com.google.common.base.Preconditions.checkArgument;
import static com.google.common.base.Preconditions.checkNotNull;

import com.google.common.collect.ImmutableList;
import com.google.protobuf.ByteString;
import io.grpc.s2a.handshaker.S2AIdentity;
import io.grpc.s2a.handshaker.ValidatePeerCertificateChainReq.VerificationMode;
import io.grpc.s2a.internal.handshaker.S2AIdentity;
import io.grpc.s2a.internal.handshaker.ValidatePeerCertificateChainReq.VerificationMode;
import java.io.IOException;
import java.security.cert.CertificateEncodingException;
import java.security.cert.CertificateException;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,14 +14,14 @@
* limitations under the License.
*/

package io.grpc.s2a.handshaker;
package io.grpc.s2a.internal.handshaker;

import static com.google.common.base.Preconditions.checkNotNull;
import static java.nio.charset.StandardCharsets.UTF_8;

import com.google.common.collect.ImmutableSet;
import io.grpc.netty.GrpcSslContexts;
import io.grpc.s2a.handshaker.S2AIdentity;
import io.grpc.s2a.internal.handshaker.S2AIdentity;
import io.netty.handler.ssl.OpenSslContextOption;
import io.netty.handler.ssl.OpenSslSessionContext;
import io.netty.handler.ssl.OpenSslX509KeyManagerFactory;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,9 +14,9 @@
* limitations under the License.
*/

package io.grpc.s2a.handshaker.tokenmanager;
package io.grpc.s2a.internal.handshaker.tokenmanager;

import io.grpc.s2a.handshaker.S2AIdentity;
import io.grpc.s2a.internal.handshaker.S2AIdentity;
import java.lang.reflect.Method;
import java.util.Optional;
import javax.annotation.concurrent.ThreadSafe;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,10 +14,10 @@
* limitations under the License.
*/

package io.grpc.s2a.handshaker.tokenmanager;
package io.grpc.s2a.internal.handshaker.tokenmanager;

import com.google.common.annotations.VisibleForTesting;
import io.grpc.s2a.handshaker.S2AIdentity;
import io.grpc.s2a.internal.handshaker.S2AIdentity;
import java.util.Optional;

/** Fetches a single access token via an environment variable. */
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,9 +14,9 @@
* limitations under the License.
*/

package io.grpc.s2a.handshaker.tokenmanager;
package io.grpc.s2a.internal.handshaker.tokenmanager;

import io.grpc.s2a.handshaker.S2AIdentity;
import io.grpc.s2a.internal.handshaker.S2AIdentity;

/** Fetches tokens used to authenticate to S2A. */
interface TokenFetcher {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
* limitations under the License.
*/

package io.grpc.s2a.channel;
package io.grpc.s2a.internal.channel;

import static com.google.common.truth.Truth.assertThat;
import static org.junit.Assert.assertThrows;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
* limitations under the License.
*/

package io.grpc.s2a.channel;
package io.grpc.s2a.internal.channel;

import static com.google.common.truth.Truth.assertThat;
import static com.google.common.truth.extensions.proto.ProtoTruth.assertThat;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
* limitations under the License.
*/

package io.grpc.s2a.handshaker;
package io.grpc.s2a.internal.handshaker;

import io.grpc.stub.StreamObserver;
import java.security.NoSuchAlgorithmException;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
* limitations under the License.
*/

package io.grpc.s2a.handshaker;
package io.grpc.s2a.internal.handshaker;

import static com.google.common.truth.extensions.proto.ProtoTruth.assertThat;
import static java.util.concurrent.TimeUnit.SECONDS;
Expand All @@ -27,7 +27,7 @@
import io.grpc.Server;
import io.grpc.ServerBuilder;
import io.grpc.benchmarks.Utils;
import io.grpc.s2a.handshaker.ValidatePeerCertificateChainReq.VerificationMode;
import io.grpc.s2a.internal.handshaker.ValidatePeerCertificateChainReq.VerificationMode;
import io.grpc.stub.StreamObserver;
import java.util.concurrent.CountDownLatch;
import java.util.concurrent.ExecutorService;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,10 +14,10 @@
* limitations under the License.
*/

package io.grpc.s2a.handshaker;
package io.grpc.s2a.internal.handshaker;

import static io.grpc.s2a.handshaker.TLSVersion.TLS_VERSION_1_2;
import static io.grpc.s2a.handshaker.TLSVersion.TLS_VERSION_1_3;
import static io.grpc.s2a.internal.handshaker.TLSVersion.TLS_VERSION_1_2;
import static io.grpc.s2a.internal.handshaker.TLSVersion.TLS_VERSION_1_3;

import com.google.common.collect.ImmutableMap;
import com.google.errorprone.annotations.CanIgnoreReturnValue;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,11 +14,11 @@
* limitations under the License.
*/

package io.grpc.s2a.handshaker;
package io.grpc.s2a.internal.handshaker;

import com.google.common.truth.Expect;
import io.grpc.s2a.handshaker.S2AIdentity;
import io.grpc.s2a.handshaker.tokenmanager.SingleTokenFetcher;
import io.grpc.s2a.internal.handshaker.S2AIdentity;
import io.grpc.s2a.internal.handshaker.tokenmanager.SingleTokenFetcher;
import java.util.Optional;
import org.junit.BeforeClass;
import org.junit.Rule;
Expand Down
Loading
Loading