atlas-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From apoorvn...@apache.org
Subject [01/12] incubator-atlas git commit: ATLAS-1198: Spring Framework (v4 with Spring security) over Guice
Date Tue, 23 May 2017 22:06:59 GMT
Repository: incubator-atlas
Updated Branches:
  refs/heads/master 35c776448 -> 35e5828fb


http://git-wip-us.apache.org/repos/asf/incubator-atlas/blob/35e5828f/webapp/src/test/java/org/apache/atlas/web/service/ActiveInstanceElectorServiceTest.java
----------------------------------------------------------------------
diff --git a/webapp/src/test/java/org/apache/atlas/web/service/ActiveInstanceElectorServiceTest.java
b/webapp/src/test/java/org/apache/atlas/web/service/ActiveInstanceElectorServiceTest.java
index d1b0318..dd2df70 100644
--- a/webapp/src/test/java/org/apache/atlas/web/service/ActiveInstanceElectorServiceTest.java
+++ b/webapp/src/test/java/org/apache/atlas/web/service/ActiveInstanceElectorServiceTest.java
@@ -18,9 +18,9 @@
 
 package org.apache.atlas.web.service;
 
-import com.google.inject.Provider;
 import org.apache.atlas.AtlasConstants;
 import org.apache.atlas.AtlasException;
+import org.apache.atlas.exception.AtlasBaseException;
 import org.apache.atlas.ha.HAConfiguration;
 import org.apache.atlas.listener.ActiveStateChangeHandler;
 import org.apache.commons.configuration.Configuration;
@@ -32,15 +32,10 @@ import org.testng.annotations.BeforeMethod;
 import org.testng.annotations.Test;
 
 import java.io.IOException;
-import java.util.ArrayList;
-import java.util.Collection;
-import org.apache.atlas.exception.AtlasBaseException;
-import static org.mockito.Mockito.doThrow;
-import static org.mockito.Mockito.inOrder;
-import static org.mockito.Mockito.mock;
-import static org.mockito.Mockito.verify;
-import static org.mockito.Mockito.verifyZeroInteractions;
-import static org.mockito.Mockito.when;
+import java.util.HashSet;
+import java.util.Set;
+
+import static org.mockito.Mockito.*;
 
 public class ActiveInstanceElectorServiceTest {
 
@@ -75,7 +70,7 @@ public class ActiveInstanceElectorServiceTest {
         when(curatorFactory.leaderLatchInstance("id1", HAConfiguration.ATLAS_SERVER_ZK_ROOT_DEFAULT)).thenReturn(leaderLatch);
 
         ActiveInstanceElectorService activeInstanceElectorService =
-                new ActiveInstanceElectorService(configuration, new ArrayList(), curatorFactory,
+                new ActiveInstanceElectorService(configuration, new HashSet<ActiveStateChangeHandler>(),
curatorFactory,
                         activeInstanceState, serviceState);
         activeInstanceElectorService.start();
 
@@ -96,7 +91,7 @@ public class ActiveInstanceElectorServiceTest {
         when(curatorFactory.leaderLatchInstance("id1", HAConfiguration.ATLAS_SERVER_ZK_ROOT_DEFAULT)).thenReturn(leaderLatch);
 
         ActiveInstanceElectorService activeInstanceElectorService =
-                new ActiveInstanceElectorService(configuration, new ArrayList(), curatorFactory,
+                new ActiveInstanceElectorService(configuration, new HashSet<ActiveStateChangeHandler>(),
curatorFactory,
                         activeInstanceState, serviceState);
         activeInstanceElectorService.start();
 
@@ -108,7 +103,7 @@ public class ActiveInstanceElectorServiceTest {
         when(configuration.getBoolean(HAConfiguration.ATLAS_SERVER_HA_ENABLED_KEY, false)).thenReturn(false);
 
         ActiveInstanceElectorService activeInstanceElectorService =
-                new ActiveInstanceElectorService(configuration, new ArrayList(), curatorFactory,
+                new ActiveInstanceElectorService(configuration, new HashSet<ActiveStateChangeHandler>(),
curatorFactory,
                         activeInstanceState, serviceState);
         activeInstanceElectorService.start();
 
@@ -129,7 +124,7 @@ public class ActiveInstanceElectorServiceTest {
         when(curatorFactory.leaderLatchInstance("id1", HAConfiguration.ATLAS_SERVER_ZK_ROOT_DEFAULT)).thenReturn(leaderLatch);
 
         ActiveInstanceElectorService activeInstanceElectorService =
-                new ActiveInstanceElectorService(configuration, new ArrayList(), curatorFactory,
+                new ActiveInstanceElectorService(configuration, new HashSet<ActiveStateChangeHandler>(),
curatorFactory,
                         activeInstanceState, serviceState);
         activeInstanceElectorService.start();
         activeInstanceElectorService.stop();
@@ -151,7 +146,7 @@ public class ActiveInstanceElectorServiceTest {
         when(curatorFactory.leaderLatchInstance("id1", HAConfiguration.ATLAS_SERVER_ZK_ROOT_DEFAULT)).thenReturn(leaderLatch);
 
         ActiveInstanceElectorService activeInstanceElectorService =
-                new ActiveInstanceElectorService(configuration, new ArrayList(), curatorFactory,
+                new ActiveInstanceElectorService(configuration, new HashSet<ActiveStateChangeHandler>(),
curatorFactory,
                         activeInstanceState, serviceState);
         activeInstanceElectorService.start();
         activeInstanceElectorService.stop();
@@ -165,7 +160,7 @@ public class ActiveInstanceElectorServiceTest {
         when(configuration.getBoolean(HAConfiguration.ATLAS_SERVER_HA_ENABLED_KEY, false)).thenReturn(false);
 
         ActiveInstanceElectorService activeInstanceElectorService =
-                new ActiveInstanceElectorService(configuration, new ArrayList(), curatorFactory,
+                new ActiveInstanceElectorService(configuration, new HashSet<ActiveStateChangeHandler>(),
curatorFactory,
                         activeInstanceState, serviceState);
         activeInstanceElectorService.stop();
 
@@ -185,23 +180,12 @@ public class ActiveInstanceElectorServiceTest {
         LeaderLatch leaderLatch = mock(LeaderLatch.class);
         when(curatorFactory.leaderLatchInstance("id1", HAConfiguration.ATLAS_SERVER_ZK_ROOT_DEFAULT)).thenReturn(leaderLatch);
 
-        Collection<Provider<ActiveStateChangeHandler>> changeHandlers = new ArrayList();
+        Set<ActiveStateChangeHandler> changeHandlers = new HashSet<>();
         final ActiveStateChangeHandler handler1 = mock(ActiveStateChangeHandler.class);
         final ActiveStateChangeHandler handler2 = mock(ActiveStateChangeHandler.class);
 
-        changeHandlers.add(new Provider<ActiveStateChangeHandler>() {
-            @Override
-            public ActiveStateChangeHandler get() {
-                return handler1;
-            }
-        });
-
-        changeHandlers.add(new Provider<ActiveStateChangeHandler>() {
-            @Override
-            public ActiveStateChangeHandler get() {
-                return handler2;
-            }
-        });
+        changeHandlers.add(handler1);
+        changeHandlers.add(handler2);
 
         ActiveInstanceElectorService activeInstanceElectorService =
                 new ActiveInstanceElectorService(configuration, changeHandlers, curatorFactory,
@@ -227,7 +211,7 @@ public class ActiveInstanceElectorServiceTest {
         when(curatorFactory.leaderLatchInstance("id1", HAConfiguration.ATLAS_SERVER_ZK_ROOT_DEFAULT)).thenReturn(leaderLatch);
 
         ActiveInstanceElectorService activeInstanceElectorService =
-                new ActiveInstanceElectorService(configuration, new ArrayList(), curatorFactory,
+                new ActiveInstanceElectorService(configuration, new HashSet<ActiveStateChangeHandler>(),
curatorFactory,
                         activeInstanceState, serviceState);
 
         activeInstanceElectorService.start();
@@ -250,23 +234,12 @@ public class ActiveInstanceElectorServiceTest {
         LeaderLatch leaderLatch = mock(LeaderLatch.class);
         when(curatorFactory.leaderLatchInstance("id1", HAConfiguration.ATLAS_SERVER_ZK_ROOT_DEFAULT)).thenReturn(leaderLatch);
 
-        Collection<Provider<ActiveStateChangeHandler>> changeHandlers = new ArrayList();
+        Set<ActiveStateChangeHandler> changeHandlers = new HashSet<>();
         final ActiveStateChangeHandler handler1 = mock(ActiveStateChangeHandler.class);
         final ActiveStateChangeHandler handler2 = mock(ActiveStateChangeHandler.class);
 
-        changeHandlers.add(new Provider<ActiveStateChangeHandler>() {
-            @Override
-            public ActiveStateChangeHandler get() {
-                return handler1;
-            }
-        });
-
-        changeHandlers.add(new Provider<ActiveStateChangeHandler>() {
-            @Override
-            public ActiveStateChangeHandler get() {
-                return handler2;
-            }
-        });
+        changeHandlers.add(handler1);
+        changeHandlers.add(handler2);
 
         doThrow(new AtlasBaseException()).when(activeInstanceState).update("id1");
 
@@ -297,7 +270,7 @@ public class ActiveInstanceElectorServiceTest {
         doThrow(new AtlasBaseException()).when(activeInstanceState).update("id1");
 
         ActiveInstanceElectorService activeInstanceElectorService =
-                new ActiveInstanceElectorService(configuration, new ArrayList(), curatorFactory,
+                new ActiveInstanceElectorService(configuration, new HashSet<ActiveStateChangeHandler>(),
curatorFactory,
                         activeInstanceState, serviceState);
 
         activeInstanceElectorService.start();
@@ -324,23 +297,12 @@ public class ActiveInstanceElectorServiceTest {
         LeaderLatch leaderLatch = mock(LeaderLatch.class);
         when(curatorFactory.leaderLatchInstance("id1", HAConfiguration.ATLAS_SERVER_ZK_ROOT_DEFAULT)).thenReturn(leaderLatch);
 
-        Collection<Provider<ActiveStateChangeHandler>> changeHandlers = new ArrayList();
+        Set<ActiveStateChangeHandler> changeHandlers = new HashSet<>();
         final ActiveStateChangeHandler handler1 = mock(ActiveStateChangeHandler.class);
         final ActiveStateChangeHandler handler2 = mock(ActiveStateChangeHandler.class);
 
-        changeHandlers.add(new Provider<ActiveStateChangeHandler>() {
-            @Override
-            public ActiveStateChangeHandler get() {
-                return handler1;
-            }
-        });
-
-        changeHandlers.add(new Provider<ActiveStateChangeHandler>() {
-            @Override
-            public ActiveStateChangeHandler get() {
-                return handler2;
-            }
-        });
+        changeHandlers.add(handler1);
+        changeHandlers.add(handler2);
 
         ActiveInstanceElectorService activeInstanceElectorService =
                 new ActiveInstanceElectorService(configuration, changeHandlers, curatorFactory,
@@ -355,7 +317,7 @@ public class ActiveInstanceElectorServiceTest {
     @Test
     public void testActiveStateSetOnBecomingLeader() {
         ActiveInstanceElectorService activeInstanceElectorService =
-                new ActiveInstanceElectorService(configuration, new ArrayList(),
+                new ActiveInstanceElectorService(configuration, new HashSet<ActiveStateChangeHandler>(),
                         curatorFactory, activeInstanceState, serviceState);
 
         activeInstanceElectorService.isLeader();
@@ -368,7 +330,7 @@ public class ActiveInstanceElectorServiceTest {
     @Test
     public void testPassiveStateSetOnLoosingLeadership() {
         ActiveInstanceElectorService activeInstanceElectorService =
-                new ActiveInstanceElectorService(configuration, new ArrayList(),
+                new ActiveInstanceElectorService(configuration, new HashSet<ActiveStateChangeHandler>(),
                         curatorFactory, activeInstanceState, serviceState);
 
         activeInstanceElectorService.notLeader();
@@ -395,7 +357,7 @@ public class ActiveInstanceElectorServiceTest {
         doThrow(new AtlasBaseException()).when(activeInstanceState).update("id1");
 
         ActiveInstanceElectorService activeInstanceElectorService =
-                new ActiveInstanceElectorService(configuration, new ArrayList(),
+                new ActiveInstanceElectorService(configuration, new HashSet<ActiveStateChangeHandler>(),
                         curatorFactory, activeInstanceState, serviceState);
         activeInstanceElectorService.start();
         activeInstanceElectorService.isLeader();

http://git-wip-us.apache.org/repos/asf/incubator-atlas/blob/35e5828f/webapp/src/test/java/org/apache/atlas/web/service/SecureEmbeddedServerTestBase.java
----------------------------------------------------------------------
diff --git a/webapp/src/test/java/org/apache/atlas/web/service/SecureEmbeddedServerTestBase.java
b/webapp/src/test/java/org/apache/atlas/web/service/SecureEmbeddedServerTestBase.java
index 5d4ca97..41c3cb1 100755
--- a/webapp/src/test/java/org/apache/atlas/web/service/SecureEmbeddedServerTestBase.java
+++ b/webapp/src/test/java/org/apache/atlas/web/service/SecureEmbeddedServerTestBase.java
@@ -23,10 +23,10 @@ import org.apache.atlas.ApplicationProperties;
 import org.apache.atlas.Atlas;
 import org.apache.atlas.AtlasException;
 import org.apache.atlas.web.TestUtils;
-import org.apache.atlas.web.resources.AdminJerseyResourceIT;
-import org.apache.atlas.web.resources.EntityJerseyResourceIT;
-import org.apache.atlas.web.resources.MetadataDiscoveryJerseyResourceIT;
-import org.apache.atlas.web.resources.TypesJerseyResourceIT;
+import org.apache.atlas.web.integration.AdminJerseyResourceIT;
+import org.apache.atlas.web.integration.EntityJerseyResourceIT;
+import org.apache.atlas.web.integration.MetadataDiscoveryJerseyResourceIT;
+import org.apache.atlas.web.integration.TypesJerseyResourceIT;
 import org.apache.commons.configuration.PropertiesConfiguration;
 import org.apache.hadoop.conf.Configuration;
 import org.apache.hadoop.fs.Path;

http://git-wip-us.apache.org/repos/asf/incubator-atlas/blob/35e5828f/webapp/src/test/java/org/apache/atlas/web/setup/SetupStepsTest.java
----------------------------------------------------------------------
diff --git a/webapp/src/test/java/org/apache/atlas/web/setup/SetupStepsTest.java b/webapp/src/test/java/org/apache/atlas/web/setup/SetupStepsTest.java
index 82abc1b..7365fae 100644
--- a/webapp/src/test/java/org/apache/atlas/web/setup/SetupStepsTest.java
+++ b/webapp/src/test/java/org/apache/atlas/web/setup/SetupStepsTest.java
@@ -47,12 +47,7 @@ import java.util.LinkedHashSet;
 import java.util.List;
 import java.util.Set;
 
-import static org.mockito.Mockito.doThrow;
-import static org.mockito.Mockito.inOrder;
-import static org.mockito.Mockito.mock;
-import static org.mockito.Mockito.verify;
-import static org.mockito.Mockito.verifyZeroInteractions;
-import static org.mockito.Mockito.when;
+import static org.mockito.Mockito.*;
 import static org.testng.AssertJUnit.assertTrue;
 
 public class SetupStepsTest {
@@ -94,8 +89,8 @@ public class SetupStepsTest {
         InterProcessMutex lock = mock(InterProcessMutex.class);
         when(curatorFactory.lockInstance(HAConfiguration.ATLAS_SERVER_ZK_ROOT_DEFAULT)).
                 thenReturn(lock);
-        SetupSteps setupSteps = new SetupSteps(steps, curatorFactory);
-        setupSteps.runSetup(configuration);
+        SetupSteps setupSteps = new SetupSteps(steps, curatorFactory, configuration);
+        setupSteps.runSetup();
 
         verify(setupStep1).run();
         verify(setupStep2).run();
@@ -147,8 +142,8 @@ public class SetupStepsTest {
                 thenReturn(lock);
         InOrder inOrder = inOrder(lock, setupStep1, setupStep2);
 
-        SetupSteps setupSteps = new SetupSteps(steps, curatorFactory);
-        setupSteps.runSetup(configuration);
+        SetupSteps setupSteps = new SetupSteps(steps, curatorFactory, configuration);
+        setupSteps.runSetup();
 
         inOrder.verify(lock).acquire();
         inOrder.verify(setupStep1).run();
@@ -175,9 +170,9 @@ public class SetupStepsTest {
                 thenReturn(lock);
         InOrder inOrder = inOrder(lock, setupStep1);
 
-        SetupSteps setupSteps = new SetupSteps(steps, curatorFactory);
+        SetupSteps setupSteps = new SetupSteps(steps, curatorFactory, configuration);
         try {
-            setupSteps.runSetup(configuration);
+            setupSteps.runSetup();
         } catch (Exception e) {
             assertTrue(e instanceof SetupException);
         }
@@ -205,8 +200,8 @@ public class SetupStepsTest {
         InterProcessMutex lock = mock(InterProcessMutex.class);
         when(curatorFactory.lockInstance(HAConfiguration.ATLAS_SERVER_ZK_ROOT_DEFAULT)).
                 thenReturn(lock);
-        SetupSteps setupSteps = new SetupSteps(steps, curatorFactory);
-        setupSteps.runSetup(configuration);
+        SetupSteps setupSteps = new SetupSteps(steps, curatorFactory, configuration);
+        setupSteps.runSetup();
 
         verify(createBuilder).withACL(aclList);
         verify(createBuilder).forPath(HAConfiguration.ATLAS_SERVER_ZK_ROOT_DEFAULT+SetupSteps.SETUP_IN_PROGRESS_NODE,
@@ -231,8 +226,8 @@ public class SetupStepsTest {
         InterProcessMutex lock = mock(InterProcessMutex.class);
         when(curatorFactory.lockInstance(HAConfiguration.ATLAS_SERVER_ZK_ROOT_DEFAULT)).
                 thenReturn(lock);
-        SetupSteps setupSteps = new SetupSteps(steps, curatorFactory);
-        setupSteps.runSetup(configuration);
+        SetupSteps setupSteps = new SetupSteps(steps, curatorFactory, configuration);
+        setupSteps.runSetup();
 
         verify(deleteBuilder).forPath(HAConfiguration.ATLAS_SERVER_ZK_ROOT_DEFAULT+SetupSteps.SETUP_IN_PROGRESS_NODE);
     }
@@ -252,10 +247,10 @@ public class SetupStepsTest {
         InterProcessMutex lock = mock(InterProcessMutex.class);
         when(curatorFactory.lockInstance(HAConfiguration.ATLAS_SERVER_ZK_ROOT_DEFAULT)).
                 thenReturn(lock);
-        SetupSteps setupSteps = new SetupSteps(steps, curatorFactory);
+        SetupSteps setupSteps = new SetupSteps(steps, curatorFactory, configuration);
 
         try {
-            setupSteps.runSetup(configuration);
+            setupSteps.runSetup();
         } catch (Exception e) {
             assertTrue(e instanceof SetupException);
         }

http://git-wip-us.apache.org/repos/asf/incubator-atlas/blob/35e5828f/webapp/src/test/resources/test-spring-security.xml
----------------------------------------------------------------------
diff --git a/webapp/src/test/resources/test-spring-security.xml b/webapp/src/test/resources/test-spring-security.xml
new file mode 100644
index 0000000..0ef15d7
--- /dev/null
+++ b/webapp/src/test/resources/test-spring-security.xml
@@ -0,0 +1,116 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!-- 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. -->
+
+<beans:beans xmlns="http://www.springframework.org/schema/security"
+             xmlns:beans="http://www.springframework.org/schema/beans"
+             xmlns:security="http://www.springframework.org/schema/security"
+             xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+             xmlns:context="http://www.springframework.org/schema/context"
+             xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans.xsd
+						http://www.springframework.org/schema/security http://www.springframework.org/schema/security/spring-security.xsd
http://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-context.xsd">
+
+    <security:http pattern="/login.jsp" security="none" />
+    <security:http pattern="/css/**" security="none" />
+    <security:http pattern="/img/**" security="none" />
+    <security:http pattern="/libs/**" security="none" />
+    <security:http pattern="/js/**" security="none" />
+    <security:http pattern="/ieerror.html" security="none" />
+    <security:http pattern="/api/atlas/admin/status" security="none" />
+    <security:http pattern="/api/atlas/admin/metrics" security="none" />
+
+    <security:http create-session="always"
+                   entry-point-ref="entryPoint">
+        <security:session-management
+                session-fixation-protection="newSession" />
+        <intercept-url pattern="/**" access="isAuthenticated()" />
+        <custom-filter ref="ssoAuthenticationFilter" after="BASIC_AUTH_FILTER" />
+
+        <security:custom-filter ref="krbAuthenticationFilter" after="SERVLET_API_SUPPORT_FILTER"
/>
+        <security:custom-filter ref="csrfPreventionFilter" after="REMEMBER_ME_FILTER"
/>
+
+        <form-login
+                login-page="/login.jsp"
+                login-processing-url="/j_spring_security_check"
+                authentication-success-handler-ref="atlasAuthenticationSuccessHandler"
+                authentication-failure-handler-ref="atlasAuthenticationFailureHandler"
+                username-parameter="j_username"
+                password-parameter="j_password" />
+
+        <security:logout logout-success-url="/login.jsp" delete-cookies="ATLASSESSIONID"
+                         logout-url="/logout.html" />
+        <http-basic />
+        <headers disabled="true"/>
+        <csrf disabled="true"/>
+        <security:custom-filter position="LAST" ref="atlasAuthorizationFilter"/>
+    </security:http>
+
+    <beans:bean id="userDAO" class="org.apache.atlas.web.dao.UserDao" init-method="init"/>
+    <beans:bean id="userDetailsService" class="org.apache.atlas.web.service.UserService">
+        <beans:constructor-arg ref="userDAO"/>
+    </beans:bean>
+    <beans:bean id="atlasLDAPProvider" class="org.apache.atlas.web.security.AtlasLdapAuthenticationProvider"/>
+    <beans:bean id="atlasFileProvider" class="org.apache.atlas.web.security.AtlasFileAuthenticationProvider">
+        <beans:constructor-arg ref="userDetailsService"/>
+    </beans:bean>
+    <beans:bean id="atlasADProvider" class="org.apache.atlas.web.security.AtlasADAuthenticationProvider"/>
+    <beans:bean id="atlasAuthenticationProvider" class="org.apache.atlas.web.security.AtlasAuthenticationProvider">
+        <beans:constructor-arg index="0" ref="atlasLDAPProvider"/>
+        <beans:constructor-arg index="1" ref="atlasFileProvider"/>
+        <beans:constructor-arg index="2" ref="atlasADProvider"/>
+    </beans:bean>
+
+    <beans:bean id="krbAuthenticationFilter" class="org.apache.atlas.web.filters.AtlasAuthenticationFilter">
+    </beans:bean>
+
+    <beans:bean id="ssoAuthenticationFilter" class="org.apache.atlas.web.filters.AtlasKnoxSSOAuthenticationFilter">
+        <beans:constructor-arg name="authenticationProvider" ref="atlasAuthenticationProvider"/>
+    </beans:bean>
+
+    <beans:bean id="csrfPreventionFilter" class="org.apache.atlas.web.filters.AtlasCSRFPreventionFilter">
+    </beans:bean>
+
+    <beans:bean id="atlasAuthenticationSuccessHandler"
+                class="org.apache.atlas.web.security.AtlasAuthenticationSuccessHandler" />
+
+    <beans:bean id="atlasAuthenticationFailureHandler"
+                class="org.apache.atlas.web.security.AtlasAuthenticationFailureHandler" />
+
+    <beans:bean id="formAuthenticationEntryPoint"
+                class="org.apache.atlas.web.filters.AtlasAuthenticationEntryPoint">
+        <beans:constructor-arg value="/login.jsp"/>
+    </beans:bean>
+
+    <beans:bean id="authenticationEntryPoint"
+                class="org.springframework.security.web.authentication.www.BasicAuthenticationEntryPoint">
+        <beans:property name="realmName" value="atlas.com" />
+    </beans:bean>
+
+    <beans:bean id="entryPoint" class="org.springframework.security.web.authentication.DelegatingAuthenticationEntryPoint">
+        <beans:constructor-arg>
+            <beans:map>
+                <beans:entry key="hasHeader('User-Agent','Mozilla')" value-ref="formAuthenticationEntryPoint"
/>
+            </beans:map>
+        </beans:constructor-arg>
+        <beans:property name="defaultEntryPoint" ref="authenticationEntryPoint"/>
+    </beans:bean>
+
+
+    <security:authentication-manager
+            alias="authenticationManager">
+        <security:authentication-provider
+                ref="atlasAuthenticationProvider" />
+    </security:authentication-manager>
+
+    <security:global-method-security pre-post-annotations="enabled" />
+
+    <beans:bean id = "atlasAuthorizationFilter" class="org.apache.atlas.web.filters.AtlasAuthorizationFilter"/>
+</beans:beans>

http://git-wip-us.apache.org/repos/asf/incubator-atlas/blob/35e5828f/webapp/src/test/webapp/WEB-INF/web.xml
----------------------------------------------------------------------
diff --git a/webapp/src/test/webapp/WEB-INF/web.xml b/webapp/src/test/webapp/WEB-INF/web.xml
index 011bf37..2388fbf 100755
--- a/webapp/src/test/webapp/WEB-INF/web.xml
+++ b/webapp/src/test/webapp/WEB-INF/web.xml
@@ -24,51 +24,52 @@
     <display-name>Apache Atlas</display-name>
     <description>Metadata Management and Data Governance Platform over Hadoop</description>
 
-    <context-param>
-        <param-name>guice.packages</param-name>
-        <param-value>
-            org.apache.atlas.web.resources,org.apache.atlas.web.params,org.apache.atlas.web.rest,org.apache.atlas.web.errors
-        </param-value>
-    </context-param>
-  
-    <context-param>
-        <param-name>com.sun.jersey.api.json.POJOMappingFeature</param-name>
-        <param-value>true</param-value>
-    </context-param>
-
     <!--
         More information can be found here:
 
         https://jersey.java.net/nonav/apidocs/1.11/contribs/jersey-guice/com/sun/jersey/guice/spi/container/servlet/package-summary.html
      -->
 
+    <servlet>
+        <servlet-name>jersey-servlet</servlet-name>
+        <servlet-class>
+            com.sun.jersey.spi.spring.container.servlet.SpringServlet
+        </servlet-class>
+        <init-param>
+            <param-name>com.sun.jersey.api.json.POJOMappingFeature</param-name>
+            <param-value>true</param-value>
+        </init-param>
+        <load-on-startup>1</load-on-startup>
+    </servlet>
+
+    <servlet-mapping>
+        <servlet-name>jersey-servlet</servlet-name>
+        <url-pattern>/api/atlas/*</url-pattern>
+    </servlet-mapping>
+
     <filter>
         <filter-name>springSecurityFilterChain</filter-name>
         <filter-class>org.springframework.web.filter.DelegatingFilterProxy</filter-class>
     </filter>
-    
-    <filter>
-        <filter-name>guiceFilter</filter-name>
-        <filter-class>com.google.inject.servlet.GuiceFilter</filter-class>
-    </filter>
-    
+
     <filter-mapping>
         <filter-name>springSecurityFilterChain</filter-name>
         <url-pattern>/*</url-pattern>
     </filter-mapping>
-    
+
+    <filter>
+        <filter-name>AuditFilter</filter-name>
+        <filter-class>org.apache.atlas.web.filters.AuditFilter</filter-class>
+    </filter>
+
     <filter-mapping>
-        <filter-name>guiceFilter</filter-name>
+        <filter-name>AuditFilter</filter-name>
         <url-pattern>/*</url-pattern>
     </filter-mapping>
 
     <listener>
         <listener-class>org.springframework.web.util.Log4jConfigListener</listener-class>
     </listener>
-    
-    <listener>
-        <listener-class>org.apache.atlas.web.listeners.TestGuiceServletConfig</listener-class>
-    </listener>
 
     <listener>
         <listener-class>org.springframework.web.context.request.RequestContextListener</listener-class>
@@ -88,5 +89,5 @@
         </cookie-config>
     </session-config>
 
-	
+
 </web-app>


Mime
View raw message