mirror of
https://github.com/apache/zeppelin
synced 2026-05-24 09:38:26 +00:00
Handle the case of user want to start zeppelin without Shiro
- Refactor handler, if not shiro ini foundm start zeppelin wihtout shiro
This commit is contained in:
parent
09387cea8a
commit
f67f82e7e4
1 changed files with 13 additions and 9 deletions
|
|
@ -26,7 +26,10 @@ import java.util.Set;
|
|||
import javax.servlet.DispatcherType;
|
||||
import javax.ws.rs.core.Application;
|
||||
|
||||
import org.apache.commons.lang.StringUtils;
|
||||
import org.apache.cxf.jaxrs.servlet.CXFNonSpringJaxrsServlet;
|
||||
import org.apache.shiro.web.env.EnvironmentLoaderListener;
|
||||
import org.apache.shiro.web.servlet.ShiroFilter;
|
||||
import org.apache.zeppelin.conf.ZeppelinConfiguration;
|
||||
import org.apache.zeppelin.conf.ZeppelinConfiguration.ConfVars;
|
||||
import org.apache.zeppelin.dep.DependencyResolver;
|
||||
|
|
@ -259,15 +262,16 @@ public class ZeppelinServer extends Application {
|
|||
webapp.setSessionHandler(new SessionHandler());
|
||||
webapp.addServlet(cxfServletHolder, "/api/*");
|
||||
|
||||
webapp.setInitParameter("shiroConfigLocations",
|
||||
new File(conf.getShiroPath()).toURI().toString());
|
||||
|
||||
SecurityUtils.initSecurityManager(conf.getShiroPath());
|
||||
webapp.addFilter(org.apache.shiro.web.servlet.ShiroFilter.class, "/api/*",
|
||||
EnumSet.allOf(DispatcherType.class));
|
||||
|
||||
webapp.addEventListener(new org.apache.shiro.web.env.EnvironmentLoaderListener());
|
||||
|
||||
String shiroIniPath = conf.getShiroPath();
|
||||
if (!StringUtils.isBlank(shiroIniPath)) {
|
||||
webapp.setInitParameter("shiroConfigLocations", new File(shiroIniPath).toURI().toString());
|
||||
SecurityUtils.initSecurityManager(shiroIniPath);
|
||||
webapp.addFilter(ShiroFilter.class, "/api/*", EnumSet.allOf(DispatcherType.class));
|
||||
webapp.addEventListener(new EnvironmentLoaderListener());
|
||||
} else {
|
||||
webapp.addFilter(new FilterHolder(CorsFilter.class),
|
||||
"/api/*", EnumSet.allOf(DispatcherType.class));
|
||||
}
|
||||
}
|
||||
|
||||
private static WebAppContext setupWebAppContext(ContextHandlerCollection contexts,
|
||||
|
|
|
|||
Loading…
Reference in a new issue