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-966 - NPE when Shiro is misconfigured (Rob Vesse via lmccay)
Date Fri, 09 Jun 2017 15:09:16 GMT
Repository: knox
Updated Branches:
  refs/heads/master f4ccdfd69 -> 1ecb6934a


KNOX-966 - NPE when Shiro is misconfigured (Rob Vesse via lmccay)

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

Branch: refs/heads/master
Commit: 1ecb6934a4aa1128f9c168dbc822e055e9e09452
Parents: f4ccdfd
Author: Larry McCay <lmccay@hortonworks.com>
Authored: Fri Jun 9 11:09:05 2017 -0400
Committer: Larry McCay <lmccay@hortonworks.com>
Committed: Fri Jun 9 11:09:05 2017 -0400

----------------------------------------------------------------------
 .../hadoop/gateway/filter/ShiroSubjectIdentityAdapter.java      | 5 +++++
 1 file changed, 5 insertions(+)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/knox/blob/1ecb6934/gateway-provider-security-shiro/src/main/java/org/apache/hadoop/gateway/filter/ShiroSubjectIdentityAdapter.java
----------------------------------------------------------------------
diff --git a/gateway-provider-security-shiro/src/main/java/org/apache/hadoop/gateway/filter/ShiroSubjectIdentityAdapter.java
b/gateway-provider-security-shiro/src/main/java/org/apache/hadoop/gateway/filter/ShiroSubjectIdentityAdapter.java
index 705430c..b625f34 100644
--- a/gateway-provider-security-shiro/src/main/java/org/apache/hadoop/gateway/filter/ShiroSubjectIdentityAdapter.java
+++ b/gateway-provider-security-shiro/src/main/java/org/apache/hadoop/gateway/filter/ShiroSubjectIdentityAdapter.java
@@ -93,6 +93,11 @@ public class ShiroSubjectIdentityAdapter implements Filter {
         }
       };
       Subject shiroSubject = SecurityUtils.getSubject();
+
+      if (shiroSubject == null || shiroSubject.getPrincipal() == null) {
+        throw new IllegalStateException("Unable to determine authenticated user from Shiro,
please check that your Knox Shiro configuration is correct");
+      }
+
       final String principal = (String) shiroSubject.getPrincipal().toString();
       HashSet emptySet = new HashSet();
       Set<Principal> principals = new HashSet<>();


Mime
View raw message