From fded29e3f965db7630972837ec4fffc3e883145b Mon Sep 17 00:00:00 2001
From: David Li
Date: Fri, 22 Sep 2023 10:46:24 -0400
Subject: [PATCH] GH-37722: [Java][FlightRPC] Deprecate stateful login methods
---
.../org/apache/arrow/flight/auth/ClientAuthHandler.java | 7 +++++++
.../org/apache/arrow/flight/auth/ServerAuthHandler.java | 9 +++++++++
2 files changed, 16 insertions(+)
diff --git a/java/flight/flight-core/src/main/java/org/apache/arrow/flight/auth/ClientAuthHandler.java b/java/flight/flight-core/src/main/java/org/apache/arrow/flight/auth/ClientAuthHandler.java
index 985e10aa4dd..af7da86e009 100644
--- a/java/flight/flight-core/src/main/java/org/apache/arrow/flight/auth/ClientAuthHandler.java
+++ b/java/flight/flight-core/src/main/java/org/apache/arrow/flight/auth/ClientAuthHandler.java
@@ -19,9 +19,16 @@
import java.util.Iterator;
+import org.apache.arrow.flight.FlightClient;
+
/**
* Implement authentication for Flight on the client side.
+ *
+ * @deprecated As of 14.0.0. This implements a stateful "login" flow that does not play well with
+ * distributed or stateless systems. It will not be removed, but should not be used. Instead
+ * see {@link FlightClient#authenticateBasicToken(String, String)}.
*/
+@Deprecated
public interface ClientAuthHandler {
/**
* Handle the initial handshake with the server.
diff --git a/java/flight/flight-core/src/main/java/org/apache/arrow/flight/auth/ServerAuthHandler.java b/java/flight/flight-core/src/main/java/org/apache/arrow/flight/auth/ServerAuthHandler.java
index 3a978b131f2..378027c9287 100644
--- a/java/flight/flight-core/src/main/java/org/apache/arrow/flight/auth/ServerAuthHandler.java
+++ b/java/flight/flight-core/src/main/java/org/apache/arrow/flight/auth/ServerAuthHandler.java
@@ -20,9 +20,18 @@
import java.util.Iterator;
import java.util.Optional;
+import org.apache.arrow.flight.FlightServer;
+import org.apache.arrow.flight.auth2.CallHeaderAuthenticator;
+
/**
* Interface for Server side authentication handlers.
+ *
+ * @deprecated As of 14.0.0. This implements a stateful "login" flow that does not play well with
+ * distributed or stateless systems. It will not be removed, but should not be used. Instead,
+ * see {@link FlightServer.Builder#headerAuthenticator(CallHeaderAuthenticator)}
+ * and {@link CallHeaderAuthenticator}.
*/
+@Deprecated
public interface ServerAuthHandler {
/**