You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@knox.apache.org by pz...@apache.org on 2019/08/29 18:52:51 UTC

[knox] branch master updated: KNOX-2000 - KnoxSession should not set javax.security.auth.useSubjectCredsOnly

This is an automated email from the ASF dual-hosted git repository.

pzampino pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/knox.git


The following commit(s) were added to refs/heads/master by this push:
     new b1cc3a7  KNOX-2000 - KnoxSession should not set javax.security.auth.useSubjectCredsOnly
b1cc3a7 is described below

commit b1cc3a7e1737231777ca3d3fc5bd8168a51fe0cf
Author: pzampino <pz...@cloudera.com>
AuthorDate: Thu Aug 29 14:50:31 2019 -0400

    KNOX-2000 - KnoxSession should not set javax.security.auth.useSubjectCredsOnly
---
 .../org/apache/knox/gateway/shell/ClientContext.java |  8 --------
 .../org/apache/knox/gateway/shell/KnoxSession.java   |  3 ---
 .../apache/knox/gateway/shell/KnoxSessionTest.java   | 20 --------------------
 3 files changed, 31 deletions(-)

diff --git a/gateway-shell/src/main/java/org/apache/knox/gateway/shell/ClientContext.java b/gateway-shell/src/main/java/org/apache/knox/gateway/shell/ClientContext.java
index e4d7861..b003a58 100644
--- a/gateway-shell/src/main/java/org/apache/knox/gateway/shell/ClientContext.java
+++ b/gateway-shell/src/main/java/org/apache/knox/gateway/shell/ClientContext.java
@@ -275,11 +275,6 @@ public class ClientContext {
     return context;
   }
 
-  public ClientContext withSubjectCredsOnly(boolean useSubjectCredsOnly) {
-    configuration.setProperty("useSubjectCredsOnly", useSubjectCredsOnly);
-    return this;
-  }
-
   public String username() {
     return configuration.getString("username");
   }
@@ -292,7 +287,4 @@ public class ClientContext {
     return configuration.getString("url");
   }
 
-  public boolean useSubjectCredsOnly() {
-    return configuration.getBoolean("useSubjectCredsOnly", false);
-  }
 }
diff --git a/gateway-shell/src/main/java/org/apache/knox/gateway/shell/KnoxSession.java b/gateway-shell/src/main/java/org/apache/knox/gateway/shell/KnoxSession.java
index 00f5ffd..7c817f4 100644
--- a/gateway-shell/src/main/java/org/apache/knox/gateway/shell/KnoxSession.java
+++ b/gateway-shell/src/main/java/org/apache/knox/gateway/shell/KnoxSession.java
@@ -326,9 +326,6 @@ public class KnoxSession implements Closeable {
         System.setProperty("sun.security.jgss.debug", "true");
       }
 
-      System.setProperty("javax.security.auth.useSubjectCredsOnly",
-                         String.valueOf(clientContext.useSubjectCredsOnly()));
-
       final Registry<AuthSchemeProvider> authSchemeRegistry =
           RegistryBuilder.<AuthSchemeProvider>create().register(AuthSchemes.SPNEGO, new SPNegoSchemeFactory(true)).build();
 
diff --git a/gateway-shell/src/test/java/org/apache/knox/gateway/shell/KnoxSessionTest.java b/gateway-shell/src/test/java/org/apache/knox/gateway/shell/KnoxSessionTest.java
index 6207419..e408ff7 100644
--- a/gateway-shell/src/test/java/org/apache/knox/gateway/shell/KnoxSessionTest.java
+++ b/gateway-shell/src/test/java/org/apache/knox/gateway/shell/KnoxSessionTest.java
@@ -88,26 +88,6 @@ public class KnoxSessionTest {
   }
 
   /**
-   * KNOX-1861
-   */
-  @Test
-  public void testConfigurableUseSubjectCredsOnly() {
-    final String url = "";
-
-    // The default should be false
-    ClientContext context = ClientContext.with(url);
-    assertFalse(context.useSubjectCredsOnly());
-
-    // Explicitly set to true
-    context = ClientContext.with(url).withSubjectCredsOnly(true);
-    assertTrue(context.useSubjectCredsOnly());
-
-    // Explicitly set to false
-    context = ClientContext.with(url).withSubjectCredsOnly(false);
-    assertFalse(context.useSubjectCredsOnly());
-  }
-
-  /**
    * Validate that the jaasConf option is applied when specified for a kerberos KnoxSession login.
    */
   @Test