Commit Graph

30 Commits

Author SHA1 Message Date
Riya Mehta 68d79b5130
s2a: Use protos published under com.google.s2a.proto.v2. (#11908) 2025-02-19 16:59:50 -08:00
Eric Anderson 16d26726cf
s2a: Don't allow S2AStub to be set
S2AStub is an internal API and shouldn't be used outside of s2a. It is
still available for tests.

IntegrationTest was moved to io.grpc.s2a. It uses a io.grpc.s2a class,
so shouldn't be in internal.handler
2025-02-14 15:47:19 -08:00
Riya Mehta a5347b2bc4
s2a: inject Optional<AccessTokenManager> in tests 2025-02-14 12:55:42 -08:00
Benjamin Peterson 8c261c3f28
Fix typo in deprecated blocking stub javadoc. (#11772) 2024-12-26 13:31:34 -08:00
Larry Safran ea8c31c305
Bidi Blocking Stub (#10318) 2024-12-20 16:16:17 -08:00
Eric Anderson 8ea3629378
Re-enable animalsniffer, fixing violations
In 61f19d707a I swapped the signatures to use the version catalog. But I
failed to preserve the `@signature` extension and it all seemed to
work... But in fact all the animalsniffer tasks were completing as
SKIPPED as they lacked signatures. The build.gradle changes in this
commit are to fix that while still using version catalog.

But while it was broken violations crept in. Most violations weren't
too important and we're not surprised went unnoticed. For example, Netty
with TLS has long required the Java 8 API
`setEndpointIdentificationAlgorithm()`, so using `Optional` in the same
code path didn't harm anything in particular. I still swapped it to
Guava's `Optional` to avoid overuse of `@IgnoreJRERequirement`.

One important violation has not been fixed and instead I've disabled the
android signature in api/build.gradle for the moment.  The violation is
in StatusException using the `fillInStackTrace` overload of Exception.
This problem [had been noticed][PR11066], but we couldn't figure out
what was going on. AnimalSniffer is now noticing this and agreeing with
the internal linter. There is still a question of why our interop tests
failed to notice this, but given they are no longer running on pre-API
level 24, that may forever be a mystery.

[PR11066]: https://github.com/grpc/grpc-java/pull/11066
2024-12-19 07:54:54 -08:00
Eric Anderson 99a2696c48 s2a: Restore static token state mutated in tests
This is the easy-to-fix state, but GetAuthenticationMechanisms can save
these temporary states used in tests, so more fixes will be necessary.
2024-12-09 14:12:32 -08:00
Riya Mehta 55cef6330f
s2a: Load resources from classpath instead of from disk 2024-11-27 10:48:59 -08:00
Riya Mehta 29dd9bad3f change s2av2_credentials to s2a 2024-11-26 08:01:08 -08:00
Riya Mehta 546efd79f1
s2a: fix flake in FakeS2AServerTest (#11673)
While here:
 * add an awaitTermination to after calling shutdown on server
 * don't use port picker

Fixes #11648
2024-11-08 10:25:49 -08:00
Eric Anderson 3562380da5 Upgrade Gradle to 8.10.2 and upgrade plugins
com.github.johnrengelman.shadow is now com.gradleup.shadow (note the
redirect)
https://github.com/johnrengelman/shadow/releases/tag/8.3.0
2024-10-30 07:00:57 -07:00
Riya Mehta a01a9e2340
Enable publishing. (#11581) 2024-10-10 16:32:10 -07:00
Riya Mehta d628396ec7
s2a: Add S2AStub cleanup handler. (#11600)
* Add S2AStub cleanup handler.

* Give TLS and Cleanup handlers name + update comment.

* Don't add TLS handler twice.

* Don't remove explicitly, since done by fireProtocolNegotiationEvent.

* plumb S2AStub close to handshake end + add integration test.

* close stub when TLS negotiation fails.
2024-10-10 16:31:18 -07:00
Riya Mehta 9d252c2466
Don't use Utils.pickUnusedPort. (#11601) 2024-10-08 10:57:32 -07:00
Riya Mehta 0a3c03446c
s2a: Correct type of exception thrown (#11588)
* throw IllegalArgumentException in ProtoUtil.

* throw exception in TrustManager in more standard way.

* handle IllegalArgumentException in SslContextFactory.

* Don't throw error on unknown TLS version.
2024-10-08 10:56:43 -07:00
Riya Mehta 35f0d56894
s2a: don't use reflection to load token manager (#11590) 2024-10-03 14:45:01 -07:00
Riya Mehta 959060a824
s2a: Address comments on S2A channel + stub (#11584)
* delete HandshakerServiceChannel.

* remove usage of S2AGrpcChannelPool + avoid creating Channel ref per conn.
2024-10-02 16:01:23 -07:00
Riya Mehta b8a0ba44af
s2a: clean up usage of certs (#11583)
* use CertificateUtils.

* Different names for each ec cert.

* Generate rsa certs with ::1 IP + delete CSRs.

* try.
2024-10-02 12:55:21 -07:00
Riya Mehta 927d21541d
s2a: Move s2a implementation to internal package 2024-10-01 08:24:18 -07:00
Riya Mehta 50e442fea6
s2a: Include full exception in IOException 2024-09-30 15:05:14 -07:00
Riya Mehta 7b4b109309
s2a: remove channelPool from S2AChannelCredentials builder. (#11573) 2024-09-30 12:55:42 -07:00
Riya Mehta a140e1bb0c
s2a: Combine MtlsToS2ChannelCredentials and S2AChannelCredentials. (#11544)
* Combine MtlsToS2ChannelCredentials and S2AChannelCredentials.

* Check if file exists.

* S2AChannelCredentials API requires credentials used for client-s2a channel.

* remove MtlsToS2A library in BUILD.

* Don't check state twice.

* Don't check for file existence in tests.
2024-09-30 09:49:09 -07:00
Riya Mehta fa18fec36e
s2a: Address minor comments on PR#11113 (#11540)
* Use StandardCharsets in FakeS2AServerTest.
* Use add instead of offer in S2AStub.
* remove dead code in ProtoUtil.java.
* Mark convertTlsProtocolVersion as VisibleForTesting.
* S2AStub doesn't return responses at front of queue.
* Remove global SHARED_RESOURCE_CHANNELS.
* Don't suppress RethrowReflectiveOperationExceptionAsLinkageError.
* Update javadoc.
* Make clear which certs are used in tests + add how to regenerate.
2024-09-27 08:47:56 -07:00
Eric Anderson c92453fb14
s2a: Disabling publishing until it is ready for users 2024-09-24 15:40:40 -07:00
Riya Mehta d8f73e0456
s2a: Address comments on PR#11113 (#11534)
* Mark S2A public APIs as experimental.

* Rename S2AChannelCredentials createBuilder API to newBuilder.

* Remove usage of AdvancedTls.

* Use InsecureChannelCredentials.create instead of Optional.

* Invoke Thread.currentThread().interrupt() in a InterruptedException block.
2024-09-20 15:53:14 -07:00
Riya Mehta e75a044107
s2a,netty: S2AHandshakerServiceChannel doesn't use custom event loop. (#11539)
* S2AHandshakerServiceChannel doesn't use custom event loop.

* use executorPool.

* log when channel not shutdown.

* use a cached threadpool.

* update non-executor version.
2024-09-20 12:32:54 -07:00
Eric Anderson 9b0c19e698 s2a: Cleanups to IntegrationTest
Move unused and unimportant fields to local variables. pickUnusedPort()
is inherently racy, so avoid using it when unnecessary. The channel's
default executor is fine to use, but if you don't like it
directExecutor() would be an option too. But blocking stub doesn't even
use the executor for unary RPCs. Thread.join() does not propagate
exceptions from the Thread; it just waits for the thread to exit.
2024-09-18 09:52:03 -07:00
Larry Safran bdc0530e1d
Fix slow tests that took 40 seconds to get through tearDown. (#11530) 2024-09-17 11:12:27 -07:00
Eric Anderson ce33df4a6f s2a: Use new-style syntax for plugins and remove unused deps
There may be more unused deps, but #11527 makes it far too painful for
me to bother to clean it up more.
2024-09-16 15:44:34 -07:00
Riya Mehta b8c1aa517a
s2a: Add gRPC S2A (#11113) 2024-09-13 17:11:17 -07:00