Repository: incubator-zeppelin Updated Branches: refs/heads/master 715526824 -> 02a042b1f
ZEPPELIN-797: Shiro authentication dialog does not appear ### What is this PR for? Shiro authentication dialog does not appear This is with reference with shiro authentication dialog not showing up on the mail thread. https://mail-archives.apache.org/mod_mbox/incubator-zeppelin-users/201603.mbox/%3CCALf24sbx9tY-hSXR7zhGXuAirWujn20Sc9CoZnLBmeBt_NbhDwmail.gmail.com%3E ### What type of PR is it? Bug Fix ### Todos * [x] - add ServletContextHandler filter for IniShiroFilter ### What is the Jira issue? https://issues.apache.org/jira/browse/ZEPPELIN-797 ### How should this be tested? Run zeppelin-server from `zeppelin-distribution/target/zeppelin-0.6.0-incubating-SNAPSHOT/zeppelin-0.6.0-incubating-SNAPSHOT/` It should honour the `shiro.ini` located inside `zeppelin-distribution/target/zeppelin-0.6.0-incubating-SNAPSHOT/zeppelin-0.6.0-incubating-SNAPSHOT/conf/` ### Screenshots (if appropriate) N/A ### Questions: * Does the licenses files need update? no * Is there breaking changes for older versions? no * Does this needs documentation? no Author: Prabhjyot Singh <[email protected]> Closes #824 from prabhjyotsingh/ZEPPELIN-797 and squashes the following commits: 24a8e54 [Prabhjyot Singh] get shiro path from conf.getShiroPath() 8d0704a [Prabhjyot Singh] remove IniShiroFilter as it is depricated a82a9c8 [Prabhjyot Singh] ZEPPELIN-797: Shiro authentication dialog does not appear Project: http://git-wip-us.apache.org/repos/asf/incubator-zeppelin/repo Commit: http://git-wip-us.apache.org/repos/asf/incubator-zeppelin/commit/02a042b1 Tree: http://git-wip-us.apache.org/repos/asf/incubator-zeppelin/tree/02a042b1 Diff: http://git-wip-us.apache.org/repos/asf/incubator-zeppelin/diff/02a042b1 Branch: refs/heads/master Commit: 02a042b1fdbd9d89f611d4440f022483c7cd2bd5 Parents: 7155268 Author: Prabhjyot Singh <[email protected]> Authored: Fri Apr 8 10:18:27 2016 +0530 Committer: Prabhjyot Singh <[email protected]> Committed: Sat Apr 9 08:52:18 2016 +0530 ---------------------------------------------------------------------- .../apache/zeppelin/server/ZeppelinServer.java | 26 +++++++++++--------- .../zeppelin/conf/ZeppelinConfiguration.java | 4 +++ 2 files changed, 18 insertions(+), 12 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/incubator-zeppelin/blob/02a042b1/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 9fe8dab..d57aa71 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 @@ -17,16 +17,6 @@ package org.apache.zeppelin.server; -import java.io.File; -import java.io.IOException; -import java.util.EnumSet; -import java.util.HashSet; -import java.util.Set; - -import javax.net.ssl.SSLContext; -import javax.servlet.DispatcherType; -import javax.ws.rs.core.Application; - import org.apache.cxf.jaxrs.servlet.CXFNonSpringJaxrsServlet; import org.apache.zeppelin.conf.ZeppelinConfiguration; import org.apache.zeppelin.conf.ZeppelinConfiguration.ConfVars; @@ -38,8 +28,8 @@ import org.apache.zeppelin.notebook.repo.NotebookRepo; import org.apache.zeppelin.notebook.repo.NotebookRepoSync; import org.apache.zeppelin.rest.*; import org.apache.zeppelin.scheduler.SchedulerFactory; -import org.apache.zeppelin.search.SearchService; import org.apache.zeppelin.search.LuceneSearch; +import org.apache.zeppelin.search.SearchService; import org.apache.zeppelin.socket.NotebookServer; import org.eclipse.jetty.server.AbstractConnector; import org.eclipse.jetty.server.Handler; @@ -57,6 +47,15 @@ import org.eclipse.jetty.webapp.WebAppContext; import org.slf4j.Logger; import org.slf4j.LoggerFactory; +import javax.net.ssl.SSLContext; +import javax.servlet.DispatcherType; +import javax.ws.rs.core.Application; +import java.io.File; +import java.io.IOException; +import java.util.EnumSet; +import java.util.HashSet; +import java.util.Set; + /** * Main class of Zeppelin. * @@ -86,7 +85,7 @@ public class ZeppelinServer extends Application { this.notebookRepo = new NotebookRepoSync(conf); this.notebookIndex = new LuceneSearch(); this.notebookAuthorization = new NotebookAuthorization(conf); - notebook = new Notebook(conf, + notebook = new Notebook(conf, notebookRepo, schedulerFactory, replFactory, notebookWsServer, notebookIndex, notebookAuthorization); } @@ -235,6 +234,9 @@ public class ZeppelinServer extends Application { cxfContext.addFilter(new FilterHolder(CorsFilter.class), "/*", EnumSet.allOf(DispatcherType.class)); + cxfContext.setInitParameter("shiroConfigLocations", + new File(conf.getShiroPath()).toURI().toString()); + cxfContext.addFilter(org.apache.shiro.web.servlet.ShiroFilter.class, "/*", EnumSet.allOf(DispatcherType.class)); http://git-wip-us.apache.org/repos/asf/incubator-zeppelin/blob/02a042b1/zeppelin-zengine/src/main/java/org/apache/zeppelin/conf/ZeppelinConfiguration.java ---------------------------------------------------------------------- diff --git a/zeppelin-zengine/src/main/java/org/apache/zeppelin/conf/ZeppelinConfiguration.java b/zeppelin-zengine/src/main/java/org/apache/zeppelin/conf/ZeppelinConfiguration.java index 9e2ba5b..541aae1 100644 --- a/zeppelin-zengine/src/main/java/org/apache/zeppelin/conf/ZeppelinConfiguration.java +++ b/zeppelin-zengine/src/main/java/org/apache/zeppelin/conf/ZeppelinConfiguration.java @@ -350,6 +350,10 @@ public class ZeppelinConfiguration extends XMLConfiguration { return getRelativeDir(String.format("%s/notebook-authorization.json", getConfDir())); } + public String getShiroPath() { + return getRelativeDir(String.format("%s/shiro.ini", getConfDir())); + } + public String getInterpreterRemoteRunnerPath() { return getRelativeDir(ConfVars.ZEPPELIN_INTERPRETER_REMOTE_RUNNER); }
