Repository: zeppelin Updated Branches: refs/heads/branch-0.8 380a92768 -> d3de51562
ZEPPELIN-3332 Zeppelin login fails with NPE if ldapRealm.authorizationEnabled is not set true ### What is this PR for? Simply fixes NPE by checking for null ### What type of PR is it? Bug Fix ### What is the Jira issue? https://issues.apache.org/jira/browse/ZEPPELIN-3332 ### Questions: Does the licenses files need update? No Is there breaking changes for older versions? No Does this needs documentation? No Author: bag_of_tricks <falb...@hortonworks.com> Closes #2911 from felixalbani/ZEPPELIN-3332 and squashes the following commits: c6ccf4189 [bag_of_tricks] ZEPPELIN-3332 622333eb9 [bag_of_tricks] Revert "ZEPPELIN-3332" dd7d37dac [bag_of_tricks] ZEPPELIN-3332 (cherry picked from commit 685eb9249d1c1d821ce57f1ed0559f1539dfbe69) Signed-off-by: Lee moon soo <m...@apache.org> Project: http://git-wip-us.apache.org/repos/asf/zeppelin/repo Commit: http://git-wip-us.apache.org/repos/asf/zeppelin/commit/d3de5156 Tree: http://git-wip-us.apache.org/repos/asf/zeppelin/tree/d3de5156 Diff: http://git-wip-us.apache.org/repos/asf/zeppelin/diff/d3de5156 Branch: refs/heads/branch-0.8 Commit: d3de5156234cb88caa39931fd4086b29df0b9d39 Parents: 380a927 Author: bag_of_tricks <falb...@hortonworks.com> Authored: Thu Apr 5 12:27:18 2018 -0400 Committer: Lee moon soo <m...@apache.org> Committed: Thu Apr 5 12:17:10 2018 -0700 ---------------------------------------------------------------------- .../src/main/java/org/apache/zeppelin/utils/SecurityUtils.java | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/zeppelin/blob/d3de5156/zeppelin-server/src/main/java/org/apache/zeppelin/utils/SecurityUtils.java ---------------------------------------------------------------------- diff --git a/zeppelin-server/src/main/java/org/apache/zeppelin/utils/SecurityUtils.java b/zeppelin-server/src/main/java/org/apache/zeppelin/utils/SecurityUtils.java index e24af20..50f167b 100644 --- a/zeppelin-server/src/main/java/org/apache/zeppelin/utils/SecurityUtils.java +++ b/zeppelin-server/src/main/java/org/apache/zeppelin/utils/SecurityUtils.java @@ -55,7 +55,7 @@ public class SecurityUtils { private static final HashSet<String> EMPTY_HASHSET = Sets.newHashSet(); private static boolean isEnabled = false; private static final Logger log = LoggerFactory.getLogger(SecurityUtils.class); - + public static void setIsEnabled(boolean value) { isEnabled = value; } @@ -149,7 +149,9 @@ public class SecurityUtils { new SimplePrincipalCollection(subject.getPrincipal(), realm.getName()), ((LdapRealm) realm).getContextFactory() ); - roles = new HashSet<>(auth.getRoles()); + if (auth != null) { + roles = new HashSet<>(auth.getRoles()); + } } catch (NamingException e) { log.error("Can't fetch roles", e); }