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

Migrates the java client authentication to Flight Auth v2 #3423

Merged
merged 4 commits into from
Feb 28, 2023

Conversation

devinrsmith
Copy link
Member

There are also plumbing improvements that allow constructing sessions with specific authentication values, and the sharing of authenticated channels without extraneous duplication of logic.

Fixes #3285

There are also plumbing improvements that allow constructing sessions with specific authentication values, and the sharing of authenticated channels without extraneous duplication of logic.

Fixes deephaven#3285
@devinrsmith
Copy link
Member Author

This work was done in support of testing #3410. I wanted to take a bit further wrt DH URIs and BarrageTableResolver, but have time-bounded this work for now and filed #3421

@@ -33,6 +32,9 @@ interface Builder extends BarrageSessionFactoryBuilder {

Builder allocator(@BindsInstance BufferAllocator bufferAllocator);

Builder authenticationTypeAndValue(
@BindsInstance @Nullable @Named("authenticationTypeAndValue") String authenticationTypeAndValue);
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is this sufficient? Does this allow for bi-directional authentication schemes?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No.

I think we want a working example we can interact with to come up with a better interface. Either way, the structure in main right now only supports anonymous authentication, and this adds on the ability for one-and-done type auth.

That said, I'm not generally happy w/ the structure of BarrageSubcomponent, FlightSubcomponent, SessionSubcomponent (I know I was the one who made them). We may want to remove some of these layers of abstractions or provide better interfaces for users to hook into.


public String toAuthenticationTypeAndValue() {
if (mtls != null && mtls) {
// todo
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is this a lost comment? Or should we add an issue tag?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Meant to remove. We may eventually want proper string constants somewhere publicly accessible for authentication methods we support out of the box.

@@ -20,6 +20,10 @@ public class FlightSession implements AutoCloseable {

public static FlightSession of(SessionImpl session, BufferAllocator incomingAllocator,
ManagedChannel channel) {
// Note: this pattern of FlightClient owning the ManagedChannel does not mesh well with the idea that some
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This comment is golden. Thanks; well said.

this.serialManager = TableHandleManagerSerial.of(this);
this.batchManager = TableHandleManagerBatch.of(this, config.mixinStacktrace());
this.pingJob = config.executor().scheduleAtFixedRate(
() -> bearerChannel.config().getConfigurationConstants(
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Cristian pointed out that when the server was unavailable that the client retried in an excessive repetitive manner. Have you verified that this no longer happens? I believed it would require setting alternate grpc call options.

Also, Colin pointed out that possibly ConfigService might run on another host (say, for a cluster of instances) - should we add a ping grpc call directly to the SessionService in the event that we're hitting envoy and being routed to different hosts?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I've taken out that more "complicated" retry logic, and figured that using a fixed job that "pings" multiple times during the timeout interval is "good enough". (I don't see much value in some sort of backoff schedule... either we successfully reauth before the timeout interval, or we don't.)

I'd very much be in favor of a simple no-op "ping" RPC in SessionService; although, I think @niloc132 might have opinions? The general advice might be "use Handshake", but the code as written right now doesn't depend on Flight. Right now I'm essentially (ab)using ConfigService#getConfigurationConstants since I know the user is authorized for it.

@devinrsmith devinrsmith merged commit 203fc12 into deephaven:main Feb 28, 2023
@devinrsmith devinrsmith deleted the java-client-authentication branch February 28, 2023 02:05
@github-actions github-actions bot locked and limited conversation to collaborators Feb 28, 2023
@deephaven-internal
Copy link
Contributor

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Java Client: Migrate off of deprecated newSession/refreshSessionToken to Flight Auth
3 participants