zeppelin-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From prabhjyotsi...@apache.org
Subject zeppelin git commit: [HOTFIX][ZEPPELIN-3526] fix when no shiro.ini exists
Date Fri, 08 Jun 2018 05:42:38 GMT
Repository: zeppelin
Updated Branches:
  refs/heads/branch-0.8 9ae5de3f0 -> 3cd94d001


[HOTFIX][ZEPPELIN-3526] fix when no shiro.ini exists

This is a side effect of ZEPPELIN-3526, occurs when there's no shiro.ini in the classpath.

[Hot Fix]

* CI should be green

* Does the licenses files need update? n/a
* Is there breaking changes for older versions? n/a
* Does this needs documentation? n/a

Author: Prabhjyot Singh <prabhjyotsingh@gmail.com>

Closes #3011 from prabhjyotsingh/hotfix/ZEPPELIN-3526 and squashes the following commits:

ac6565cd3 [Prabhjyot Singh] fix ZEPPELIN-3526 when no shiro.ini exists

Change-Id: I5016e293eeec17e44be29dbf7f2668ec542a8dfa
(cherry picked from commit 9fbcacf5c528292754ce17d5b1eaab9581770583)
Signed-off-by: Prabhjyot Singh <prabhjyotsingh@gmail.com>

# Conflicts:
#	zeppelin-server/src/main/java/org/apache/zeppelin/server/ZeppelinServer.java


Project: http://git-wip-us.apache.org/repos/asf/zeppelin/repo
Commit: http://git-wip-us.apache.org/repos/asf/zeppelin/commit/3cd94d00
Tree: http://git-wip-us.apache.org/repos/asf/zeppelin/tree/3cd94d00
Diff: http://git-wip-us.apache.org/repos/asf/zeppelin/diff/3cd94d00

Branch: refs/heads/branch-0.8
Commit: 3cd94d0018dab54df3e73e175b83f06a18f8eced
Parents: 9ae5de3
Author: Prabhjyot Singh <prabhjyotsingh@gmail.com>
Authored: Fri Jun 8 09:53:49 2018 +0530
Committer: Prabhjyot Singh <prabhjyotsingh@gmail.com>
Committed: Fri Jun 8 11:11:48 2018 +0530

----------------------------------------------------------------------
 .../apache/zeppelin/server/ZeppelinServer.java  | 32 ++++++++++++--------
 1 file changed, 19 insertions(+), 13 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/zeppelin/blob/3cd94d00/zeppelin-server/src/main/java/org/apache/zeppelin/server/ZeppelinServer.java
----------------------------------------------------------------------
diff --git a/zeppelin-server/src/main/java/org/apache/zeppelin/server/ZeppelinServer.java
b/zeppelin-server/src/main/java/org/apache/zeppelin/server/ZeppelinServer.java
index 539e66e..c0467c7 100644
--- a/zeppelin-server/src/main/java/org/apache/zeppelin/server/ZeppelinServer.java
+++ b/zeppelin-server/src/main/java/org/apache/zeppelin/server/ZeppelinServer.java
@@ -28,6 +28,7 @@ import javax.servlet.DispatcherType;
 import javax.ws.rs.core.Application;
 
 import org.apache.commons.lang.StringUtils;
+import org.apache.shiro.UnavailableSecurityManagerException;
 import org.apache.shiro.realm.Realm;
 import org.apache.shiro.realm.text.IniRealm;
 import org.apache.shiro.web.env.EnvironmentLoaderListener;
@@ -95,24 +96,29 @@ public class ZeppelinServer extends Application {
 
   public ZeppelinServer() throws Exception {
     ZeppelinConfiguration conf = ZeppelinConfiguration.create();
-    Collection<Realm> realms = ((DefaultWebSecurityManager) org.apache.shiro.SecurityUtils
-        .getSecurityManager()).getRealms();
-    if (realms.size() > 1) {
-      Boolean isIniRealmEnabled = false;
-      for (Object realm : realms) {
-        if (realm instanceof IniRealm && ((IniRealm) realm).getIni().get("users")
!= null) {
-          isIniRealmEnabled = true;
-          break;
+    if (conf.getShiroPath().length() > 0) {
+      try {
+        Collection<Realm> realms = ((DefaultWebSecurityManager) org.apache.shiro.SecurityUtils
+            .getSecurityManager()).getRealms();
+        if (realms.size() > 1) {
+          Boolean isIniRealmEnabled = false;
+          for (Object realm : realms) {
+            if (realm instanceof IniRealm && ((IniRealm) realm).getIni().get("users")
!= null) {
+              isIniRealmEnabled = true;
+              break;
+            }
+          }
+          if (isIniRealmEnabled) {
+            throw new Exception("IniRealm/password based auth mechanisms should be exclusive.
"
+                + "Consider removing [users] block from shiro.ini");
+          }
         }
-      }
-      if (isIniRealmEnabled) {
-        throw new Exception("IniRealm/password based auth mechanisms should be exclusive.
"
-            + "Consider removing [users] block from shiro.ini");
+      } catch (UnavailableSecurityManagerException e) {
+        LOG.error("Failed to initialise shiro configuraion", e);
       }
     }
 
 
-
     InterpreterOutput.limit = conf.getInt(ConfVars.ZEPPELIN_INTERPRETER_OUTPUT_LIMIT);
 
     HeliumApplicationFactory heliumApplicationFactory = new HeliumApplicationFactory();


Mime
View raw message