You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@atlas.apache.org by ap...@apache.org on 2017/06/12 23:26:53 UTC

incubator-atlas git commit: ATLAS-1872: Spring fix for Kerberos and bean ordering/default

Repository: incubator-atlas
Updated Branches:
  refs/heads/master 6b9399e00 -> 82b6f727c


ATLAS-1872: Spring fix for Kerberos and bean ordering/default


Project: http://git-wip-us.apache.org/repos/asf/incubator-atlas/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-atlas/commit/82b6f727
Tree: http://git-wip-us.apache.org/repos/asf/incubator-atlas/tree/82b6f727
Diff: http://git-wip-us.apache.org/repos/asf/incubator-atlas/diff/82b6f727

Branch: refs/heads/master
Commit: 82b6f727ca272b1e86625bfaa89bb5d638a0805c
Parents: 6b9399e
Author: apoorvnaik <ap...@apache.org>
Authored: Mon Jun 12 11:06:21 2017 -0700
Committer: apoorvnaik <ap...@apache.org>
Committed: Mon Jun 12 16:26:44 2017 -0700

----------------------------------------------------------------------
 .../audit/HBaseBasedAuditRepository.java        |  2 +-
 .../audit/NoopEntityAuditRepository.java        |  2 +-
 .../atlas/web/listeners/LoginProcessor.java     |  4 ---
 .../atlas/web/setup/KerberosAwareListener.java  | 33 ++++++++++++++++++++
 webapp/src/main/webapp/WEB-INF/web.xml          |  2 +-
 5 files changed, 36 insertions(+), 7 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-atlas/blob/82b6f727/repository/src/main/java/org/apache/atlas/repository/audit/HBaseBasedAuditRepository.java
----------------------------------------------------------------------
diff --git a/repository/src/main/java/org/apache/atlas/repository/audit/HBaseBasedAuditRepository.java b/repository/src/main/java/org/apache/atlas/repository/audit/HBaseBasedAuditRepository.java
index 89ca748..06e518e 100644
--- a/repository/src/main/java/org/apache/atlas/repository/audit/HBaseBasedAuditRepository.java
+++ b/repository/src/main/java/org/apache/atlas/repository/audit/HBaseBasedAuditRepository.java
@@ -73,7 +73,7 @@ import java.util.Map;
  */
 @Singleton
 @Component
-@ConditionalOnAtlasProperty(property = "atlas.EntityAuditRepository.impl")
+@ConditionalOnAtlasProperty(property = "atlas.EntityAuditRepository.impl", isDefault = true)
 public class HBaseBasedAuditRepository implements Service, EntityAuditRepository, ActiveStateChangeHandler {
     private static final Logger LOG = LoggerFactory.getLogger(HBaseBasedAuditRepository.class);
 

http://git-wip-us.apache.org/repos/asf/incubator-atlas/blob/82b6f727/repository/src/main/java/org/apache/atlas/repository/audit/NoopEntityAuditRepository.java
----------------------------------------------------------------------
diff --git a/repository/src/main/java/org/apache/atlas/repository/audit/NoopEntityAuditRepository.java b/repository/src/main/java/org/apache/atlas/repository/audit/NoopEntityAuditRepository.java
index 7c39ce9..c382601 100644
--- a/repository/src/main/java/org/apache/atlas/repository/audit/NoopEntityAuditRepository.java
+++ b/repository/src/main/java/org/apache/atlas/repository/audit/NoopEntityAuditRepository.java
@@ -32,7 +32,7 @@ import java.util.List;
  */
 @Singleton
 @Component
-@ConditionalOnAtlasProperty(property = "atlas.EntityAuditRepository.impl", isDefault = true)
+@ConditionalOnAtlasProperty(property = "atlas.EntityAuditRepository.impl")
 public class NoopEntityAuditRepository implements EntityAuditRepository {
 
     @Override

http://git-wip-us.apache.org/repos/asf/incubator-atlas/blob/82b6f727/webapp/src/main/java/org/apache/atlas/web/listeners/LoginProcessor.java
----------------------------------------------------------------------
diff --git a/webapp/src/main/java/org/apache/atlas/web/listeners/LoginProcessor.java b/webapp/src/main/java/org/apache/atlas/web/listeners/LoginProcessor.java
index e21656e..cc2ef8a 100644
--- a/webapp/src/main/java/org/apache/atlas/web/listeners/LoginProcessor.java
+++ b/webapp/src/main/java/org/apache/atlas/web/listeners/LoginProcessor.java
@@ -26,9 +26,7 @@ import org.apache.hadoop.security.UserGroupInformation;
 import org.apache.hadoop.util.Shell;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
-import org.springframework.stereotype.Component;
 
-import javax.annotation.PostConstruct;
 import java.io.IOException;
 import java.net.InetAddress;
 import java.net.UnknownHostException;
@@ -36,7 +34,6 @@ import java.net.UnknownHostException;
 /**
  * A class capable of performing a simple or kerberos login.
  */
-@Component
 public class LoginProcessor {
 
     private static final Logger LOG = LoggerFactory.getLogger(LoginProcessor.class);
@@ -49,7 +46,6 @@ public class LoginProcessor {
      * Perform a SIMPLE login based on established OS identity or a kerberos based login using the configured
      * principal and keytab (via atlas-application.properties).
      */
-    @PostConstruct
     public void login() {
         // first, let's see if we're running in a hadoop cluster and have the env configured
         boolean isHadoopCluster = isHadoopCluster();

http://git-wip-us.apache.org/repos/asf/incubator-atlas/blob/82b6f727/webapp/src/main/java/org/apache/atlas/web/setup/KerberosAwareListener.java
----------------------------------------------------------------------
diff --git a/webapp/src/main/java/org/apache/atlas/web/setup/KerberosAwareListener.java b/webapp/src/main/java/org/apache/atlas/web/setup/KerberosAwareListener.java
new file mode 100644
index 0000000..47373b8
--- /dev/null
+++ b/webapp/src/main/java/org/apache/atlas/web/setup/KerberosAwareListener.java
@@ -0,0 +1,33 @@
+/**
+ * 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
+ * <p>
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * <p>
+ * 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.atlas.web.setup;
+
+import org.apache.atlas.web.listeners.LoginProcessor;
+import org.springframework.web.context.ContextLoaderListener;
+
+import javax.servlet.ServletContextEvent;
+
+public class KerberosAwareListener extends ContextLoaderListener {
+    @Override
+    public void contextInitialized(ServletContextEvent event) {
+        LoginProcessor loginProcessor = new LoginProcessor();
+        loginProcessor.login();
+
+        super.contextInitialized(event);
+    }
+}

http://git-wip-us.apache.org/repos/asf/incubator-atlas/blob/82b6f727/webapp/src/main/webapp/WEB-INF/web.xml
----------------------------------------------------------------------
diff --git a/webapp/src/main/webapp/WEB-INF/web.xml b/webapp/src/main/webapp/WEB-INF/web.xml
index d2d08f5..9b5c3b1 100755
--- a/webapp/src/main/webapp/WEB-INF/web.xml
+++ b/webapp/src/main/webapp/WEB-INF/web.xml
@@ -70,7 +70,7 @@
     </listener>
 
     <listener>
-        <listener-class>org.springframework.web.context.ContextLoaderListener</listener-class>
+        <listener-class>org.apache.atlas.web.setup.KerberosAwareListener</listener-class>
     </listener>