stoty commented on code in PR #5881:
URL: https://github.com/apache/hbase/pull/5881#discussion_r1601523125


##########
hbase-rest/src/main/java/org/apache/hadoop/hbase/rest/client/Client.java:
##########
@@ -176,22 +229,56 @@ public Client(Cluster cluster, Configuration conf, 
boolean sslEnabled) {
    */
   public Client(Cluster cluster, String trustStorePath, Optional<String> 
trustStorePassword,
     Optional<String> trustStoreType) {
-    this(cluster, HBaseConfiguration.create(), trustStorePath, 
trustStorePassword, trustStoreType);
+    this(cluster, HBaseConfiguration.create(), true, trustStorePath, 
trustStorePassword,
+      trustStoreType);
   }
 
   /**
-   * Constructor, allowing to define custom trust store (only for SSL 
connections)
+   * Constructor that accepts an optional trustStore and authentication 
information for either BASIC
+   * or BEARER authentication in sticky mode, which does not use the old 
faulty load balancing
+   * logic, and enables correct session handling. If neither 
userName/password, nor the bearer token
+   * is specified, the client falls back to SPNEGO auth. The loadTrustsore 
static method can be used
+   * to load a local trustStore file. This is the preferred constructor to use.
+   * @param cluster     the cluster definition
+   * @param conf        HBase/Hadoop configuration
+   * @param sslEnabled  use HTTPS
+   * @param trustStore  the optional trustStore object
+   * @param userName    for BASIC auth
+   * @param password    for BASIC auth
+   * @param bearerToken for BEAERER auth
+   */
+  public Client(Cluster cluster, Configuration conf, boolean sslEnabled,
+    Optional<KeyStore> trustStore, Optional<String> userName, Optional<String> 
password,
+    Optional<String> bearerToken) {
+    initialize(cluster, conf, sslEnabled, true, trustStore, userName, 
password, bearerToken);
+  }
+
+  /**
+   * Constructor, allowing to define custom trust store (only for SSL 
connections) This constructor
+   * also enables sticky mode. This is a preferred constructor when not using 
BASIC or JWT
+   * authentication. Clients created by this will not use the old faulty load 
balancing logic.
    * @param cluster            the cluster definition
-   * @param conf               Configuration
+   * @param conf               HBase/Hadoop Configuration
    * @param trustStorePath     custom trust store to use for SSL connections
    * @param trustStorePassword password to use for custom trust store
    * @param trustStoreType     type of custom trust store
    * @throws ClientTrustStoreInitializationException if the trust store file 
can not be loaded
    */
-  public Client(Cluster cluster, Configuration conf, String trustStorePath,
+  public Client(Cluster cluster, Configuration conf, boolean sslEnabled, 
String trustStorePath,

Review Comment:
   The comment is also incorrect, as this set sticky to false.
   I will fix the comment as well.



##########
hbase-rest/src/main/java/org/apache/hadoop/hbase/rest/client/Client.java:
##########
@@ -176,22 +229,56 @@ public Client(Cluster cluster, Configuration conf, 
boolean sslEnabled) {
    */
   public Client(Cluster cluster, String trustStorePath, Optional<String> 
trustStorePassword,
     Optional<String> trustStoreType) {
-    this(cluster, HBaseConfiguration.create(), trustStorePath, 
trustStorePassword, trustStoreType);
+    this(cluster, HBaseConfiguration.create(), true, trustStorePath, 
trustStorePassword,
+      trustStoreType);
   }
 
   /**
-   * Constructor, allowing to define custom trust store (only for SSL 
connections)
+   * Constructor that accepts an optional trustStore and authentication 
information for either BASIC
+   * or BEARER authentication in sticky mode, which does not use the old 
faulty load balancing
+   * logic, and enables correct session handling. If neither 
userName/password, nor the bearer token
+   * is specified, the client falls back to SPNEGO auth. The loadTrustsore 
static method can be used
+   * to load a local trustStore file. This is the preferred constructor to use.
+   * @param cluster     the cluster definition
+   * @param conf        HBase/Hadoop configuration
+   * @param sslEnabled  use HTTPS
+   * @param trustStore  the optional trustStore object
+   * @param userName    for BASIC auth
+   * @param password    for BASIC auth
+   * @param bearerToken for BEAERER auth
+   */
+  public Client(Cluster cluster, Configuration conf, boolean sslEnabled,
+    Optional<KeyStore> trustStore, Optional<String> userName, Optional<String> 
password,
+    Optional<String> bearerToken) {
+    initialize(cluster, conf, sslEnabled, true, trustStore, userName, 
password, bearerToken);
+  }
+
+  /**
+   * Constructor, allowing to define custom trust store (only for SSL 
connections) This constructor
+   * also enables sticky mode. This is a preferred constructor when not using 
BASIC or JWT
+   * authentication. Clients created by this will not use the old faulty load 
balancing logic.
    * @param cluster            the cluster definition
-   * @param conf               Configuration
+   * @param conf               HBase/Hadoop Configuration
    * @param trustStorePath     custom trust store to use for SSL connections
    * @param trustStorePassword password to use for custom trust store
    * @param trustStoreType     type of custom trust store
    * @throws ClientTrustStoreInitializationException if the trust store file 
can not be loaded
    */
-  public Client(Cluster cluster, Configuration conf, String trustStorePath,
+  public Client(Cluster cluster, Configuration conf, boolean sslEnabled, 
String trustStorePath,

Review Comment:
   The comment is also incorrect, as this sets sticky to false.
   I will fix the comment as well.



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to