Commit 82b6f727 by apoorvnaik

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

parent 6b9399e0
...@@ -73,7 +73,7 @@ import java.util.Map; ...@@ -73,7 +73,7 @@ import java.util.Map;
*/ */
@Singleton @Singleton
@Component @Component
@ConditionalOnAtlasProperty(property = "atlas.EntityAuditRepository.impl") @ConditionalOnAtlasProperty(property = "atlas.EntityAuditRepository.impl", isDefault = true)
public class HBaseBasedAuditRepository implements Service, EntityAuditRepository, ActiveStateChangeHandler { public class HBaseBasedAuditRepository implements Service, EntityAuditRepository, ActiveStateChangeHandler {
private static final Logger LOG = LoggerFactory.getLogger(HBaseBasedAuditRepository.class); private static final Logger LOG = LoggerFactory.getLogger(HBaseBasedAuditRepository.class);
......
...@@ -32,7 +32,7 @@ import java.util.List; ...@@ -32,7 +32,7 @@ import java.util.List;
*/ */
@Singleton @Singleton
@Component @Component
@ConditionalOnAtlasProperty(property = "atlas.EntityAuditRepository.impl", isDefault = true) @ConditionalOnAtlasProperty(property = "atlas.EntityAuditRepository.impl")
public class NoopEntityAuditRepository implements EntityAuditRepository { public class NoopEntityAuditRepository implements EntityAuditRepository {
@Override @Override
......
...@@ -26,9 +26,7 @@ import org.apache.hadoop.security.UserGroupInformation; ...@@ -26,9 +26,7 @@ import org.apache.hadoop.security.UserGroupInformation;
import org.apache.hadoop.util.Shell; import org.apache.hadoop.util.Shell;
import org.slf4j.Logger; import org.slf4j.Logger;
import org.slf4j.LoggerFactory; import org.slf4j.LoggerFactory;
import org.springframework.stereotype.Component;
import javax.annotation.PostConstruct;
import java.io.IOException; import java.io.IOException;
import java.net.InetAddress; import java.net.InetAddress;
import java.net.UnknownHostException; import java.net.UnknownHostException;
...@@ -36,7 +34,6 @@ import java.net.UnknownHostException; ...@@ -36,7 +34,6 @@ import java.net.UnknownHostException;
/** /**
* A class capable of performing a simple or kerberos login. * A class capable of performing a simple or kerberos login.
*/ */
@Component
public class LoginProcessor { public class LoginProcessor {
private static final Logger LOG = LoggerFactory.getLogger(LoginProcessor.class); private static final Logger LOG = LoggerFactory.getLogger(LoginProcessor.class);
...@@ -49,7 +46,6 @@ public class LoginProcessor { ...@@ -49,7 +46,6 @@ public class LoginProcessor {
* Perform a SIMPLE login based on established OS identity or a kerberos based login using the configured * Perform a SIMPLE login based on established OS identity or a kerberos based login using the configured
* principal and keytab (via atlas-application.properties). * principal and keytab (via atlas-application.properties).
*/ */
@PostConstruct
public void login() { public void login() {
// first, let's see if we're running in a hadoop cluster and have the env configured // first, let's see if we're running in a hadoop cluster and have the env configured
boolean isHadoopCluster = isHadoopCluster(); boolean isHadoopCluster = isHadoopCluster();
......
/**
* 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);
}
}
...@@ -70,7 +70,7 @@ ...@@ -70,7 +70,7 @@
</listener> </listener>
<listener> <listener>
<listener-class>org.springframework.web.context.ContextLoaderListener</listener-class> <listener-class>org.apache.atlas.web.setup.KerberosAwareListener</listener-class>
</listener> </listener>
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment