Repository: zeppelin Updated Branches: refs/heads/master 7a9572d67 -> 685eb9249
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 Project: http://git-wip-us.apache.org/repos/asf/zeppelin/repo Commit: http://git-wip-us.apache.org/repos/asf/zeppelin/commit/685eb924 Tree: http://git-wip-us.apache.org/repos/asf/zeppelin/tree/685eb924 Diff: http://git-wip-us.apache.org/repos/asf/zeppelin/diff/685eb924 Branch: refs/heads/master Commit: 685eb9249d1c1d821ce57f1ed0559f1539dfbe69 Parents: 7a9572d 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:16:42 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/685eb924/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 7762384..f9f5f22 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 @@ -53,7 +53,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; } @@ -147,7 +147,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); }