atlas-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From apoorvn...@apache.org
Subject incubator-atlas git commit: ATLAS-1872: Spring fix for Kerberos and bean ordering/default
Date Mon, 12 Jun 2017 23:28:34 GMT
Repository: incubator-atlas
Updated Branches:
  refs/heads/0.8-incubating 399aca8d8 -> 46295b55f


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

(cherry picked from commit 82b6f72)


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

Branch: refs/heads/0.8-incubating
Commit: 46295b55ffad443d8514f6477d78e2eac8a7d6ed
Parents: 399aca8
Author: apoorvnaik <apoorvnaik@apache.org>
Authored: Mon Jun 12 11:06:21 2017 -0700
Committer: apoorvnaik <apoorvnaik@apache.org>
Committed: Mon Jun 12 16:28:25 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/46295b55/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/46295b55/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/46295b55/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/46295b55/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/46295b55/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>
 
 


Mime
View raw message