knox-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From lmc...@apache.org
Subject knox git commit: KNOX-661 - NPE in Pac4j Provider when clientName Parameter is Missing
Date Sat, 30 Jan 2016 21:39:43 GMT
Repository: knox
Updated Branches:
  refs/heads/master dea839117 -> 0c9c334cb


KNOX-661 - NPE in Pac4j Provider when clientName Parameter is Missing

Project: http://git-wip-us.apache.org/repos/asf/knox/repo
Commit: http://git-wip-us.apache.org/repos/asf/knox/commit/0c9c334c
Tree: http://git-wip-us.apache.org/repos/asf/knox/tree/0c9c334c
Diff: http://git-wip-us.apache.org/repos/asf/knox/diff/0c9c334c

Branch: refs/heads/master
Commit: 0c9c334cb2d7bc5f4cb6609734de1654197d5ada
Parents: dea8391
Author: Larry McCay <lmccay@hortonworks.com>
Authored: Sat Jan 30 16:39:36 2016 -0500
Committer: Larry McCay <lmccay@hortonworks.com>
Committed: Sat Jan 30 16:39:36 2016 -0500

----------------------------------------------------------------------
 CHANGES                                                        | 1 +
 .../java/org/apache/hadoop/gateway/pac4j/Pac4jMessages.java    | 3 +++
 .../hadoop/gateway/pac4j/filter/Pac4jDispatcherFilter.java     | 6 +++++-
 3 files changed, 9 insertions(+), 1 deletion(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/knox/blob/0c9c334c/CHANGES
----------------------------------------------------------------------
diff --git a/CHANGES b/CHANGES
index e3c6ff6..9e4fa40 100644
--- a/CHANGES
+++ b/CHANGES
@@ -28,6 +28,7 @@ Release Notes - Apache Knox - Version 0.8.0
     * [KNOX-656] - Test GatewayLdapPosixGroupFuncTest failing intermittently
     * [KNOX-657] - _default Topology Must Redeploy After Restart
     * [KNOX-660] - Incompatible Dependencies in Pac4j Provider
+    * [KNOX-661] - NPE in Pac4j Provider when clientName Parameter is Missing
 
 ------------------------------------------------------------------------------
 Release Notes - Apache Knox - Version 0.7.0

http://git-wip-us.apache.org/repos/asf/knox/blob/0c9c334c/gateway-provider-security-pac4j/src/main/java/org/apache/hadoop/gateway/pac4j/Pac4jMessages.java
----------------------------------------------------------------------
diff --git a/gateway-provider-security-pac4j/src/main/java/org/apache/hadoop/gateway/pac4j/Pac4jMessages.java
b/gateway-provider-security-pac4j/src/main/java/org/apache/hadoop/gateway/pac4j/Pac4jMessages.java
index 51be6a0..931e494 100644
--- a/gateway-provider-security-pac4j/src/main/java/org/apache/hadoop/gateway/pac4j/Pac4jMessages.java
+++ b/gateway-provider-security-pac4j/src/main/java/org/apache/hadoop/gateway/pac4j/Pac4jMessages.java
@@ -32,6 +32,9 @@ public interface Pac4jMessages {
   @Message( level = MessageLevel.ERROR, text = "pac4j callback URL required")
   public void ssoAuthenticationProviderUrlRequired();
 
+  @Message( level = MessageLevel.ERROR, text = "pac4j clientName parameter required")
+  public void clientNameParameterRequired();
+
   @Message( level = MessageLevel.ERROR, text = "At least one pac4j client must be defined")
   public void atLeastOnePac4jClientMustBeDefined();
 

http://git-wip-us.apache.org/repos/asf/knox/blob/0c9c334c/gateway-provider-security-pac4j/src/main/java/org/apache/hadoop/gateway/pac4j/filter/Pac4jDispatcherFilter.java
----------------------------------------------------------------------
diff --git a/gateway-provider-security-pac4j/src/main/java/org/apache/hadoop/gateway/pac4j/filter/Pac4jDispatcherFilter.java
b/gateway-provider-security-pac4j/src/main/java/org/apache/hadoop/gateway/pac4j/filter/Pac4jDispatcherFilter.java
index da446ab..79955a0 100644
--- a/gateway-provider-security-pac4j/src/main/java/org/apache/hadoop/gateway/pac4j/filter/Pac4jDispatcherFilter.java
+++ b/gateway-provider-security-pac4j/src/main/java/org/apache/hadoop/gateway/pac4j/filter/Pac4jDispatcherFilter.java
@@ -118,8 +118,12 @@ public class Pac4jDispatcherFilter implements Filter {
 
     final Config config;
     final String clientName;
-    // client name from servlet parameter (if defined)
+    // client name from servlet parameter (mandatory)
     final String clientNameParameter = filterConfig.getInitParameter(Pac4jConstants.CLIENT_NAME);
+    if (clientNameParameter == null) {
+      log.clientNameParameterRequired();
+      throw new ServletException("Required pac4j clientName parameter is missing.");
+    }
     if (TEST_BASIC_AUTH.equalsIgnoreCase(clientNameParameter)) {
       // test configuration
       final IndirectBasicAuthClient indirectBasicAuthClient = new IndirectBasicAuthClient(new
SimpleTestUsernamePasswordAuthenticator());


Mime
View raw message