jongyoul commented on a change in pull request #3488: [ZEPPELIN-4356] Zeppelin 
should stop/die/etc when can't create/access notebook repo
URL: https://github.com/apache/zeppelin/pull/3488#discussion_r337508521
 
 

 ##########
 File path: 
zeppelin-server/src/main/java/org/apache/zeppelin/service/ShiroValidationService.java
 ##########
 @@ -0,0 +1,91 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *    http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.zeppelin.service;
+
+import org.apache.shiro.realm.Realm;
+import org.apache.shiro.realm.text.IniRealm;
+import org.apache.shiro.util.ThreadContext;
+import org.apache.shiro.web.mgt.DefaultWebSecurityManager;
+import org.apache.zeppelin.conf.ZeppelinConfiguration;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+import javax.inject.Inject;
+import java.util.Collection;
+
+/**
+ * ShiroValidationService to validate shiro config
+ */
+public class ShiroValidationService {
+
+  private static final Logger LOGGER = 
LoggerFactory.getLogger(ShiroValidationService.class);
+
+  @Inject
+  public ShiroValidationService(ZeppelinConfiguration conf) throws Exception {
+    LOGGER.info("ShiroValidationService is initializing");
+    init(conf);
+  }
+
+  public void init(ZeppelinConfiguration conf) throws Exception {
+    if (conf.getShiroPath().length() > 0) {
+      loadSecurityManager();
+      validateRealms();
+    }
+    LOGGER.info("ShiroValidationService is initialized.");
+  }
+
+  private synchronized void loadSecurityManager() throws Exception {
+    long waitTime = 500;
+    Integer nosOfTry = 0;
 
 Review comment:
   This class is injected by `ServiceLocator` not initializing manually, What I 
mean is to initialize it manually and to pass the instance into the injector. 
By doing this, you might control the SecurityManger's lifecycle.

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


With regards,
Apache Git Services

Reply via email to