Luke Taylor 15 years ago
parent
commit
893f212fa5
25 changed files with 326 additions and 476 deletions
  1. 1 1
      acl/src/test/java/org/springframework/security/acls/domain/ObjectIdentityImplTests.java
  2. 5 5
      acl/src/test/java/org/springframework/security/acls/domain/ObjectIdentityRetrievalStrategyImplTests.java
  3. 1 1
      config/src/main/java/org/springframework/security/config/http/RememberMeBeanDefinitionParser.java
  4. 1 0
      config/src/test/java/org/springframework/security/config/http/HttpSecurityBeanDefinitionParserTests.java
  5. 1 1
      config/src/test/java/org/springframework/security/config/method/InterceptMethodsBeanDefinitionDecoratorTests.java
  6. 1 2
      core/src/main/java/org/springframework/security/access/expression/method/ExpressionBasedPreInvocationAdvice.java
  7. 1 1
      core/src/main/java/org/springframework/security/core/authority/mapping/MapBasedAttributes2GrantedAuthoritiesMapper.java
  8. 0 51
      core/src/main/resources/org/springframework/security/adapters/acegisecurity.xml
  9. 0 38
      core/src/main/resources/org/springframework/security/adapters/adaptertest-invalid.xml
  10. 0 51
      core/src/main/resources/org/springframework/security/adapters/adaptertest-valid.xml
  11. 5 5
      core/src/test/java/org/springframework/security/access/hierarchicalroles/TestHelperTests.java
  12. 1 0
      core/src/test/java/org/springframework/security/access/intercept/method/MapBasedMethodSecurityMetadataSourceTests.java
  13. 1 0
      core/src/test/java/org/springframework/security/access/vote/AbstractAclVoterTests.java
  14. 0 4
      core/src/test/java/org/springframework/security/core/authority/GrantedAuthorityImplTests.java
  15. 82 82
      core/src/test/java/org/springframework/security/remoting/dns/JndiDnsResolverTest.java
  16. 56 57
      samples/contacts/client/clientContext.xml
  17. 36 36
      samples/contacts/src/main/webapp/WEB-INF/remoting-servlet.xml
  18. 6 6
      samples/dms/src/main/resources/applicationContext-dms-shared.xml
  19. 13 13
      samples/tutorial/src/main/webapp/WEB-INF/bank-servlet.xml
  20. 0 4
      taglibs/src/test/java/org/springframework/security/taglibs/authz/AuthorizeTagCustomGrantedAuthorityTests.java
  21. 1 0
      web/src/test/java/org/springframework/security/web/authentication/DefaultLoginPageGeneratingFilterTests.java
  22. 0 4
      web/src/test/java/org/springframework/security/web/authentication/switchuser/SwitchUserFilterTests.java
  23. 3 3
      web/src/test/java/org/springframework/security/web/authentication/www/DigestAuthenticationFilterTests.java
  24. 37 37
      web/src/test/resources/webxml/NoRoles.web.xml
  25. 74 74
      web/src/test/resources/webxml/Role1-4.web.xml

+ 1 - 1
acl/src/test/java/org/springframework/security/acls/domain/ObjectIdentityImplTests.java

@@ -12,6 +12,7 @@ import org.springframework.security.acls.model.ObjectIdentity;
  *
  * @author Andrei Stefan
  */
+@SuppressWarnings("unused")
 public class ObjectIdentityImplTests {
 
     private static final String DOMAIN_CLASS =
@@ -174,7 +175,6 @@ public class ObjectIdentityImplTests {
         }
     }
 
-    @SuppressWarnings("unused")
     private class MockOtherIdDomainObject {
         private Object id;
 

+ 5 - 5
acl/src/test/java/org/springframework/security/acls/domain/ObjectIdentityRetrievalStrategyImplTests.java

@@ -14,20 +14,20 @@ import junit.framework.TestCase;
  */
 public class ObjectIdentityRetrievalStrategyImplTests extends TestCase {
     //~ Methods ========================================================================================================
-    
+
     public void testObjectIdentityCreation() throws Exception {
         MockIdDomainObject domain = new MockIdDomainObject();
         domain.setId(new Integer(1));
-        
+
         ObjectIdentityRetrievalStrategy retStrategy = new ObjectIdentityRetrievalStrategyImpl();
         ObjectIdentity identity = retStrategy.getObjectIdentity(domain);
-        
+
         assertNotNull(identity);
         assertEquals(identity, new ObjectIdentityImpl(domain));
     }
-    
+
     //~ Inner Classes ==================================================================================================
-    
+    @SuppressWarnings("unused")
     private class MockIdDomainObject {
         private Object id;
 

+ 1 - 1
config/src/main/java/org/springframework/security/config/http/RememberMeBeanDefinitionParser.java

@@ -36,7 +36,7 @@ class RememberMeBeanDefinitionParser implements BeanDefinitionParser {
     private final String key;
 
     RememberMeBeanDefinitionParser(String key) {
-    	this.key = key;
+        this.key = key;
     }
 
     public BeanDefinition parse(Element element, ParserContext pc) {

+ 1 - 0
config/src/test/java/org/springframework/security/config/http/HttpSecurityBeanDefinitionParserTests.java

@@ -817,6 +817,7 @@ public class HttpSecurityBeanDefinitionParserTests {
                 etf.getAuthenticationEntryPoint() instanceof MockEntryPoint);
     }
 
+    @SuppressWarnings("unused")
     private static class MockEntryPoint extends LoginUrlAuthenticationEntryPoint {
         public MockEntryPoint() {
             super.setLoginFormUrl("/notused");

+ 1 - 1
config/src/test/java/org/springframework/security/config/method/InterceptMethodsBeanDefinitionDecoratorTests.java

@@ -44,7 +44,7 @@ public class InterceptMethodsBeanDefinitionDecoratorTests {
         assertEquals(1, appContext.getBeanNamesForType(ApplicationListener.class).length);
         appContext.publishEvent(new AuthenticationSuccessEvent(new TestingAuthenticationToken("user", "")));
 
-        assertTrue(target instanceof ApplicationListener);
+        assertTrue(target instanceof ApplicationListener<?>);
     }
 
     @Test

+ 1 - 2
core/src/main/java/org/springframework/security/access/expression/method/ExpressionBasedPreInvocationAdvice.java

@@ -53,8 +53,7 @@ public class ExpressionBasedPreInvocationAdvice implements PreInvocationAuthoriz
             }
         } else if (mi.getArguments().length == 1) {
             Object arg = mi.getArguments()[0];
-            if (arg.getClass().isArray() ||
-                arg instanceof Collection) {
+            if (arg.getClass().isArray() || arg instanceof Collection<?>) {
                 filterTarget = arg;
             }
             if (filterTarget == null) {

+ 1 - 1
core/src/main/java/org/springframework/security/core/authority/mapping/MapBasedAttributes2GrantedAuthoritiesMapper.java

@@ -107,7 +107,7 @@ public class MapBasedAttributes2GrantedAuthoritiesMapper implements Attributes2G
         if ( value == null ) {
             return;
         }
-        if ( value instanceof Collection ) {
+        if ( value instanceof Collection<?> ) {
             addGrantedAuthorityCollection(result,(Collection<?>)value);
         } else if ( value instanceof Object[] ) {
             addGrantedAuthorityCollection(result,(Object[])value);

+ 0 - 51
core/src/main/resources/org/springframework/security/adapters/acegisecurity.xml

@@ -1,51 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<!DOCTYPE beans PUBLIC "-//SPRING//DTD BEAN//EN" "http://www.springframework.org/dtd/spring-beans.dtd">
-<!--
- * Copyright 2004 Acegi Technology Pty Limited
- *
- * Licensed 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.
- *
- *
- * $Id$
--->
-
-<beans>
-
-	<!-- Data access object which stores authentication information -->
-	<bean id="inMemoryDaoImpl" class="org.springframework.security.core.userdetails.memory.InMemoryDaoImpl">
-  		<property name="userMap">
-			<value>
-				rod=koala,ROLE_TELLER,ROLE_SUPERVISOR
-				dianne=emu,ROLE_TELLER
-				scott=wombat,ROLE_TELLER
-				peter=opal,disabled,ROLE_TELLER
-			</value>
-		</property>
-	</bean>
-
-	<!-- Authentication provider that queries our data access object  -->
-	<bean id="daoAuthenticationProvider" class="org.springframework.security.authentication.dao.DaoAuthenticationProvider">
-     	<property name="userDetailsService"><ref bean="inMemoryDaoImpl"/></property>
-     	<property name="forcePrincipalAsString"><value>true</value></property>
-	</bean>
-
-	<!-- The authentication manager that iterates through our only authentication provider -->
-	<bean id="authenticationManager" class="org.springframework.security.authentication.ProviderManager">
-		<property name="providers">
-		  <list>
-		    <ref bean="daoAuthenticationProvider"/>
-		  </list>
-		</property>
-	</bean>
-
-</beans>

+ 0 - 38
core/src/main/resources/org/springframework/security/adapters/adaptertest-invalid.xml

@@ -1,38 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<!DOCTYPE beans PUBLIC "-//SPRING//DTD BEAN//EN" "http://www.springframework.org/dtd/spring-beans.dtd">
-<!--
- * Copyright 2004 Acegi Technology Pty Limited
- *
- * Licensed 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.
- *
- *
- * $Id$
--->
-
-<beans>
-
-	<!-- Data access object which stores authentication information -->
-	<bean id="inMemoryDaoImpl" class="org.springframework.security.core.userdetails.memory.InMemoryDaoImpl">
-  		<property name="userMap">
-			<value>
-				rod=koala,ROLE_TELLER,ROLE_SUPERVISOR
-				dianne=emu,ROLE_TELLER
-				scott=wombat,ROLE_TELLER
-				peter=opal,disabled,ROLE_TELLER
-			</value>
-		</property>
-	</bean>
-
-	<!-- The authentication manager is deliberately missing in order to test error detection -->
-
-</beans>

+ 0 - 51
core/src/main/resources/org/springframework/security/adapters/adaptertest-valid.xml

@@ -1,51 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<!DOCTYPE beans PUBLIC "-//SPRING//DTD BEAN//EN" "http://www.springframework.org/dtd/spring-beans.dtd">
-<!--
- * Copyright 2004 Acegi Technology Pty Limited
- *
- * Licensed 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.
- *
- *
- * $Id$
--->
-
-<beans>
-
-	<!-- Data access object which stores authentication information -->
-	<bean id="inMemoryDaoImpl" class="org.springframework.security.core.userdetails.memory.InMemoryDaoImpl">
-  		<property name="userMap">
-			<value>
-				rod=koala,ROLE_TELLER,ROLE_SUPERVISOR
-				dianne=emu,ROLE_TELLER
-				scott=wombat,ROLE_TELLER
-				peter=opal,disabled,ROLE_TELLER
-			</value>
-		</property>
-	</bean>
-
-	<!-- Authentication provider that queries our data access object  -->
-	<bean id="daoAuthenticationProvider" class="org.springframework.security.authentication.dao.DaoAuthenticationProvider">
-     	<property name="userDetailsService"><ref bean="inMemoryDaoImpl"/></property>
-     	<property name="forcePrincipalAsString"><value>true</value></property>
-	</bean>
-
-	<!-- The authentication manager that iterates through our only authentication provider -->
-	<bean id="authenticationManager" class="org.springframework.security.authentication.ProviderManager">
-		<property name="providers">
-		  <list>
-		    <ref bean="daoAuthenticationProvider"/>
-		  </list>
-		</property>
-	</bean>
-
-</beans>

+ 5 - 5
core/src/test/java/org/springframework/security/access/hierarchicalroles/TestHelperTests.java

@@ -83,19 +83,19 @@ public class TestHelperTests {
         authoritiesStrings5.add("ROLE_A");
 
         assertTrue(CollectionUtils.isEqualCollection(
-                HierarchicalRolesTestHelper.toCollectionOfAuthorityStrings(authorities1),	authoritiesStrings1));
+                HierarchicalRolesTestHelper.toCollectionOfAuthorityStrings(authorities1), authoritiesStrings1));
 
         assertTrue(CollectionUtils.isEqualCollection(
-                HierarchicalRolesTestHelper.toCollectionOfAuthorityStrings(authorities2),	authoritiesStrings2));
+                HierarchicalRolesTestHelper.toCollectionOfAuthorityStrings(authorities2), authoritiesStrings2));
 
         assertTrue(CollectionUtils.isEqualCollection(
-                HierarchicalRolesTestHelper.toCollectionOfAuthorityStrings(authorities3),	authoritiesStrings3));
+                HierarchicalRolesTestHelper.toCollectionOfAuthorityStrings(authorities3), authoritiesStrings3));
 
         assertTrue(CollectionUtils.isEqualCollection(
-                HierarchicalRolesTestHelper.toCollectionOfAuthorityStrings(authorities4),	authoritiesStrings4));
+                HierarchicalRolesTestHelper.toCollectionOfAuthorityStrings(authorities4), authoritiesStrings4));
 
         assertTrue(CollectionUtils.isEqualCollection(
-                HierarchicalRolesTestHelper.toCollectionOfAuthorityStrings(authorities5),	authoritiesStrings5));
+                HierarchicalRolesTestHelper.toCollectionOfAuthorityStrings(authorities5), authoritiesStrings5));
     }
 
     // SEC-863

+ 1 - 0
core/src/test/java/org/springframework/security/access/intercept/method/MapBasedMethodSecurityMetadataSourceTests.java

@@ -47,6 +47,7 @@ public class MapBasedMethodSecurityMetadataSourceTests {
         assertEquals(ROLE_B, mds.getAttributes(someMethodString, MockService.class));
     }
 
+    @SuppressWarnings("unused")
     private class MockService {
         public void someMethod(String s) {
         }

+ 1 - 0
core/src/test/java/org/springframework/security/access/vote/AbstractAclVoterTests.java

@@ -60,6 +60,7 @@ public class AbstractAclVoterTests {
         assertEquals("The Argument", voter.getDomainObjectInstance(mi));
     }
 
+    @SuppressWarnings("unused")
     private static class TestClass {
         public void methodTakingAString(String arg) {
         }

+ 0 - 4
core/src/test/java/org/springframework/security/core/authority/GrantedAuthorityImplTests.java

@@ -89,10 +89,6 @@ public class GrantedAuthorityImplTests {
             this.role = role;
         }
 
-        public int compareTo(GrantedAuthority o) {
-            throw new UnsupportedOperationException();
-        }
-
         public String getAuthority() {
             return this.role;
         }

+ 82 - 82
core/src/test/java/org/springframework/security/remoting/dns/JndiDnsResolverTest.java

@@ -30,91 +30,91 @@ import org.junit.Before;
 import org.junit.Test;
 
 /**
- * 
+ *
  * @author Mike Wiesner
  * @since 3.0
  * @version $Id$
  */
 public class JndiDnsResolverTest {
-	
-	private JndiDnsResolver dnsResolver;
-	private InitialContextFactory contextFactory;
-	private DirContext context;
-	
-	@Before
-	public void setup() {
-		contextFactory = mock(InitialContextFactory.class);
-		context = mock(DirContext.class);
-		dnsResolver = new JndiDnsResolver();
-		dnsResolver.setCtxFactory(contextFactory);
-		when(contextFactory.getCtx()).thenReturn(context);
-	}
-	
-	@Test
-	public void testResolveIpAddress() throws Exception {
-		Attributes records = new BasicAttributes("A","63.246.7.80");	
-	
-		when(context.getAttributes("www.springsource.com", new String[] {"A"})).thenReturn(records);
-		
-		String ipAddress = dnsResolver.resolveIpAddress("www.springsource.com");
-		assertEquals("63.246.7.80", ipAddress);
-	}
-	
-	@Test(expected=DnsEntryNotFoundException.class)
-	public void testResolveIpAddressNotExisting() throws Exception {
-		when(context.getAttributes(any(String.class), any(String[].class))).thenThrow(new NameNotFoundException("not found"));
-		
-		dnsResolver.resolveIpAddress("notexisting.ansdansdugiuzgguzgioansdiandwq.foo");
-	}
-	
-	@Test
-	public void testResolveServiceEntry() throws Exception {
-		BasicAttributes records = createSrvRecords();
-		
-		when(context.getAttributes("_ldap._tcp.springsource.com", new String[] {"SRV"})).thenReturn(records);
-		
-		String hostname = dnsResolver.resolveServiceEntry("ldap", "springsource.com");
-		assertEquals("kdc.springsource.com", hostname);
-	}
-
-	
-	@Test(expected=DnsEntryNotFoundException.class)
-	public void testResolveServiceEntryNotExisting() throws Exception {
-		when(context.getAttributes(any(String.class), any(String[].class))).thenThrow(new NameNotFoundException("not found"));
-		
-		dnsResolver.resolveServiceEntry("wrong", "secpod.de");
-	}
-	
-	@Test
-	public void testResolveServiceIpAddress() throws Exception {
-		BasicAttributes srvRecords = createSrvRecords();
-		BasicAttributes aRecords = new BasicAttributes("A", "63.246.7.80");
-		when(context.getAttributes("_ldap._tcp.springsource.com", new String[] {"SRV"})).thenReturn(srvRecords);
-		when(context.getAttributes("kdc.springsource.com", new String[] {"A"})).thenReturn(aRecords);
-		
-		String ipAddress = dnsResolver.resolveServiceIpAddress("ldap", "springsource.com");
-		assertEquals("63.246.7.80", ipAddress);
-	}
-	
-	@Test(expected=DnsLookupException.class)
-	public void testUnknowError() throws Exception {
-		when(context.getAttributes(any(String.class), any(String[].class))).thenThrow(new NamingException("error"));
-		dnsResolver.resolveIpAddress("");
-	}
-
-	
-
-	private BasicAttributes createSrvRecords() {
-		BasicAttributes records = new BasicAttributes();
-		BasicAttribute record = new BasicAttribute("SRV");
-		// the structure of the service records is:
-		// priority weight port hostname
-		// for more information: http://en.wikipedia.org/wiki/SRV_record
-		record.add("20 80 389 kdc3.springsource.com.");
-		record.add("10 70 389 kdc.springsource.com.");
-		record.add("20 20 389 kdc4.springsource.com.");
-		record.add("10 30 389 kdc2.springsource.com");
-		records.put(record);
-		return records;
-	}
+
+    private JndiDnsResolver dnsResolver;
+    private InitialContextFactory contextFactory;
+    private DirContext context;
+
+    @Before
+    public void setup() {
+        contextFactory = mock(InitialContextFactory.class);
+        context = mock(DirContext.class);
+        dnsResolver = new JndiDnsResolver();
+        dnsResolver.setCtxFactory(contextFactory);
+        when(contextFactory.getCtx()).thenReturn(context);
+    }
+
+    @Test
+    public void testResolveIpAddress() throws Exception {
+        Attributes records = new BasicAttributes("A","63.246.7.80");
+
+        when(context.getAttributes("www.springsource.com", new String[] {"A"})).thenReturn(records);
+
+        String ipAddress = dnsResolver.resolveIpAddress("www.springsource.com");
+        assertEquals("63.246.7.80", ipAddress);
+    }
+
+    @Test(expected=DnsEntryNotFoundException.class)
+    public void testResolveIpAddressNotExisting() throws Exception {
+        when(context.getAttributes(any(String.class), any(String[].class))).thenThrow(new NameNotFoundException("not found"));
+
+        dnsResolver.resolveIpAddress("notexisting.ansdansdugiuzgguzgioansdiandwq.foo");
+    }
+
+    @Test
+    public void testResolveServiceEntry() throws Exception {
+        BasicAttributes records = createSrvRecords();
+
+        when(context.getAttributes("_ldap._tcp.springsource.com", new String[] {"SRV"})).thenReturn(records);
+
+        String hostname = dnsResolver.resolveServiceEntry("ldap", "springsource.com");
+        assertEquals("kdc.springsource.com", hostname);
+    }
+
+
+    @Test(expected=DnsEntryNotFoundException.class)
+    public void testResolveServiceEntryNotExisting() throws Exception {
+        when(context.getAttributes(any(String.class), any(String[].class))).thenThrow(new NameNotFoundException("not found"));
+
+        dnsResolver.resolveServiceEntry("wrong", "secpod.de");
+    }
+
+    @Test
+    public void testResolveServiceIpAddress() throws Exception {
+        BasicAttributes srvRecords = createSrvRecords();
+        BasicAttributes aRecords = new BasicAttributes("A", "63.246.7.80");
+        when(context.getAttributes("_ldap._tcp.springsource.com", new String[] {"SRV"})).thenReturn(srvRecords);
+        when(context.getAttributes("kdc.springsource.com", new String[] {"A"})).thenReturn(aRecords);
+
+        String ipAddress = dnsResolver.resolveServiceIpAddress("ldap", "springsource.com");
+        assertEquals("63.246.7.80", ipAddress);
+    }
+
+    @Test(expected=DnsLookupException.class)
+    public void testUnknowError() throws Exception {
+        when(context.getAttributes(any(String.class), any(String[].class))).thenThrow(new NamingException("error"));
+        dnsResolver.resolveIpAddress("");
+    }
+
+
+
+    private BasicAttributes createSrvRecords() {
+        BasicAttributes records = new BasicAttributes();
+        BasicAttribute record = new BasicAttribute("SRV");
+        // the structure of the service records is:
+        // priority weight port hostname
+        // for more information: http://en.wikipedia.org/wiki/SRV_record
+        record.add("20 80 389 kdc3.springsource.com.");
+        record.add("10 70 389 kdc.springsource.com.");
+        record.add("20 20 389 kdc4.springsource.com.");
+        record.add("10 30 389 kdc2.springsource.com");
+        records.put(record);
+        return records;
+    }
 }

+ 56 - 57
samples/contacts/client/clientContext.xml

@@ -4,71 +4,70 @@
 <!--
   - Contacts web application
   - Client application context
-  - $Id$
   -->
 
 <beans>
 
-	<!-- Resolves ${...} placeholders from client.properties -->
-	<bean id="propertyConfigurer" class="org.springframework.beans.factory.config.PropertyPlaceholderConfigurer">
-		<property name="location"><value>client.properties</value></property>
-	</bean>
+    <!-- Resolves ${...} placeholders from client.properties -->
+    <bean id="propertyConfigurer" class="org.springframework.beans.factory.config.PropertyPlaceholderConfigurer">
+        <property name="location"><value>client.properties</value></property>
+    </bean>
 
-	<!-- Proxy for the RMI-exported ContactManager -->
-	<!-- COMMENTED OUT BY DEFAULT TO AVOID CONFLICTS WITH APPLICATION SERVERS
-	<bean id="rmiProxy" class="org.springframework.remoting.rmi.RmiProxyFactoryBean">
-		<property name="serviceInterface">
-			<value>sample.contact.ContactManager</value>
-		</property>
-		<property name="serviceUrl">
-			<value>rmi://${serverName}:${rmiPort}/contactManager</value>
-		</property>
-		<property name="remoteInvocationFactory">
-			<ref local="remoteInvocationFactory"/>
-		</property>
-	</bean>
+    <!-- Proxy for the RMI-exported ContactManager -->
+    <!-- COMMENTED OUT BY DEFAULT TO AVOID CONFLICTS WITH APPLICATION SERVERS
+    <bean id="rmiProxy" class="org.springframework.remoting.rmi.RmiProxyFactoryBean">
+        <property name="serviceInterface">
+            <value>sample.contact.ContactManager</value>
+        </property>
+        <property name="serviceUrl">
+            <value>rmi://${serverName}:${rmiPort}/contactManager</value>
+        </property>
+        <property name="remoteInvocationFactory">
+            <ref local="remoteInvocationFactory"/>
+        </property>
+    </bean>
 
-	<bean id="remoteInvocationFactory" class="org.springframework.security.ui.rmi.ContextPropagatingRemoteInvocationFactory"/>
-	-->
+    <bean id="remoteInvocationFactory" class="org.springframework.security.ui.rmi.ContextPropagatingRemoteInvocationFactory"/>
+    -->
 
-	<!-- Proxy for the HTTP-invoker-exported ContactManager -->
-	<!-- Spring's HTTP invoker uses Java serialization via HTTP  -->
-	<bean id="httpInvokerProxy" class="org.springframework.remoting.httpinvoker.HttpInvokerProxyFactoryBean">
-		<property name="serviceInterface">
-			<value>sample.contact.ContactManager</value>
-		</property>
-		<property name="serviceUrl">
-			<value>http://${serverName}:${httpPort}${contextPath}/remoting/ContactManager-httpinvoker</value>
-		</property>
-		<property name="httpInvokerRequestExecutor">
-			<ref local="httpInvokerRequestExecutor"/>
-		</property>
-	</bean>
+    <!-- Proxy for the HTTP-invoker-exported ContactManager -->
+    <!-- Spring's HTTP invoker uses Java serialization via HTTP  -->
+    <bean id="httpInvokerProxy" class="org.springframework.remoting.httpinvoker.HttpInvokerProxyFactoryBean">
+        <property name="serviceInterface">
+            <value>sample.contact.ContactManager</value>
+        </property>
+        <property name="serviceUrl">
+            <value>http://${serverName}:${httpPort}${contextPath}/remoting/ContactManager-httpinvoker</value>
+        </property>
+        <property name="httpInvokerRequestExecutor">
+            <ref local="httpInvokerRequestExecutor"/>
+        </property>
+    </bean>
 
-	<!-- Automatically propagates ContextHolder-managed Authentication principal
-		 and credentials to a HTTP invoker BASIC authentication header -->
-	<bean id="httpInvokerRequestExecutor" class="org.springframework.security.core.context.httpinvoker.AuthenticationSimpleHttpInvokerRequestExecutor"/>
+    <!-- Automatically propagates ContextHolder-managed Authentication principal
+         and credentials to a HTTP invoker BASIC authentication header -->
+    <bean id="httpInvokerRequestExecutor" class="org.springframework.security.core.context.httpinvoker.AuthenticationSimpleHttpInvokerRequestExecutor"/>
 
-	<!-- Proxy for the Hessian-exported ContactManager
-	<bean id="hessianProxy" class="org.springframework.remoting.caucho.HessianProxyFactoryBean">
-		<property name="serviceInterface">
-			<value>sample.contact.ContactManager</value>
-		</property>
-		<property name="serviceUrl">
-			<value>http://${serverName}:${httpPort}${contextPath}/remoting/ContactManager-hessian</value>
-		</property>
-	</bean>
-	-->
+    <!-- Proxy for the Hessian-exported ContactManager
+    <bean id="hessianProxy" class="org.springframework.remoting.caucho.HessianProxyFactoryBean">
+        <property name="serviceInterface">
+            <value>sample.contact.ContactManager</value>
+        </property>
+        <property name="serviceUrl">
+            <value>http://${serverName}:${httpPort}${contextPath}/remoting/ContactManager-hessian</value>
+        </property>
+    </bean>
+    -->
 
-	<!-- Proxy for the Burlap-exported ContactManager
-	<bean id="burlapProxy" class="org.springframework.remoting.caucho.BurlapProxyFactoryBean">
-		<property name="serviceInterface">
-			<value>sample.contact.ContactManager</value>
-		</property>
-		<property name="serviceUrl">
-			<value>http://${serverName}:${httpPort}${contextPath}/remoting/ContactManager-burlap</value>
-		</property>
-	</bean>
-	-->
+    <!-- Proxy for the Burlap-exported ContactManager
+    <bean id="burlapProxy" class="org.springframework.remoting.caucho.BurlapProxyFactoryBean">
+        <property name="serviceInterface">
+            <value>sample.contact.ContactManager</value>
+        </property>
+        <property name="serviceUrl">
+            <value>http://${serverName}:${httpPort}${contextPath}/remoting/ContactManager-burlap</value>
+        </property>
+    </bean>
+    -->
 
-</beans>
+</beans>

+ 36 - 36
samples/contacts/src/main/webapp/WEB-INF/remoting-servlet.xml

@@ -7,44 +7,44 @@
   -->
 <beans>
 
-	<!-- RMI exporter for the ContactManager -->
-	<!-- This could just as easily have been in
-		 applicationContext-common-business.xml, because it doesn't rely on
-		 DispatcherServlet or indeed any other HTTP services. It's in this
-		 application context simply for logical placement with other
-		 remoting exporters. -->
-	<!-- COMMENTED OUT BY DEFAULT TO AVOID CONFLICTS WITH APPLICATION SERVERS
-	<bean id="contactManager-rmi" class="org.springframework.remoting.rmi.RmiServiceExporter">
-		<property name="service"><ref bean="contactManager"/></property>
-		<property name="serviceInterface">
-			<value>sample.contact.ContactManager</value>
-		</property>
-		<property name="serviceName"><value>contactManager</value></property>
-		<property name="registryPort"><value>1099</value></property>
-	</bean>
-	-->
+    <!-- RMI exporter for the ContactManager -->
+    <!-- This could just as easily have been in
+         applicationContext-common-business.xml, because it doesn't rely on
+         DispatcherServlet or indeed any other HTTP services. It's in this
+         application context simply for logical placement with other
+         remoting exporters. -->
+    <!-- COMMENTED OUT BY DEFAULT TO AVOID CONFLICTS WITH APPLICATION SERVERS
+    <bean id="contactManager-rmi" class="org.springframework.remoting.rmi.RmiServiceExporter">
+        <property name="service"><ref bean="contactManager"/></property>
+        <property name="serviceInterface">
+            <value>sample.contact.ContactManager</value>
+        </property>
+        <property name="serviceName"><value>contactManager</value></property>
+        <property name="registryPort"><value>1099</value></property>
+    </bean>
+    -->
 
-	<!-- HTTP invoker exporter for the ContactManager -->
-	<!-- Spring's HTTP invoker uses Java serialization via HTTP  -->
-	<bean name="/ContactManager-httpinvoker" class="org.springframework.remoting.httpinvoker.HttpInvokerServiceExporter">
-		<property name="service" ref="contactManager"/>
-		<property name="serviceInterface" value="sample.contact.ContactManager"/>
-	</bean>
+    <!-- HTTP invoker exporter for the ContactManager -->
+    <!-- Spring's HTTP invoker uses Java serialization via HTTP  -->
+    <bean name="/ContactManager-httpinvoker" class="org.springframework.remoting.httpinvoker.HttpInvokerServiceExporter">
+        <property name="service" ref="contactManager"/>
+        <property name="serviceInterface" value="sample.contact.ContactManager"/>
+    </bean>
 
-	<!-- Hessian exporter for the ContactManager -->
-	<!-- Hessian is a slim binary HTTP remoting protocol -->
-<!--	
-	<bean name="/ContactManager-hessian" class="org.springframework.remoting.caucho.HessianServiceExporter">
-		<property name="service" ref="contactManager"/>
-		<property name="serviceInterface" value="sample.contact.ContactManager"/>
-	</bean>
+    <!-- Hessian exporter for the ContactManager -->
+    <!-- Hessian is a slim binary HTTP remoting protocol -->
+<!--
+    <bean name="/ContactManager-hessian" class="org.springframework.remoting.caucho.HessianServiceExporter">
+        <property name="service" ref="contactManager"/>
+        <property name="serviceInterface" value="sample.contact.ContactManager"/>
+    </bean>
 -->
-	<!-- Burlap exporter for the ContactManager -->
-	<!-- Burlap is a slim XML-based HTTP remoting protocol -->
-<!--	
-	<bean name="/ContactManager-burlap" class="org.springframework.remoting.caucho.BurlapServiceExporter">
-		<property name="service" ref="contactManager"/>
-		<property name="serviceInterface" value="sample.contact.ContactManager"/>
-	</bean>
+    <!-- Burlap exporter for the ContactManager -->
+    <!-- Burlap is a slim XML-based HTTP remoting protocol -->
+<!--
+    <bean name="/ContactManager-burlap" class="org.springframework.remoting.caucho.BurlapServiceExporter">
+        <property name="service" ref="contactManager"/>
+        <property name="serviceInterface" value="sample.contact.ContactManager"/>
+    </bean>
 -->
 </beans>

+ 6 - 6
samples/dms/src/main/resources/applicationContext-dms-shared.xml

@@ -9,12 +9,12 @@
 
 <beans>
 
-	<bean id="transactionManager" class="org.springframework.jdbc.datasource.DataSourceTransactionManager">
-		<property name="dataSource"><ref bean="dataSource"/></property>
-	</bean>
+    <bean id="transactionManager" class="org.springframework.jdbc.datasource.DataSourceTransactionManager">
+        <property name="dataSource"><ref bean="dataSource"/></property>
+    </bean>
 
-	<bean id="autoproxy" class="org.springframework.aop.framework.autoproxy.DefaultAdvisorAutoProxyCreator" />
-	
-	<bean id="transactionAdvisor" class="org.springframework.transaction.interceptor.TransactionAttributeSourceAdvisor" autowire="constructor" />
+    <bean id="autoproxy" class="org.springframework.aop.framework.autoproxy.DefaultAdvisorAutoProxyCreator" />
+
+    <bean id="transactionAdvisor" class="org.springframework.transaction.interceptor.TransactionAttributeSourceAdvisor" autowire="constructor" />
 
 </beans>

+ 13 - 13
samples/tutorial/src/main/webapp/WEB-INF/bank-servlet.xml

@@ -4,17 +4,17 @@
     xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
     xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-3.0.xsd">
 
-	<bean name="/listAccounts.html" class="bigbank.web.ListAccounts">
-		<constructor-arg ref="bankService"/>
-	</bean>
-	
-	<bean name="/post.html" class="bigbank.web.PostAccounts">
-		<constructor-arg ref="bankService"/>
-	</bean>
-	
-	<bean id="viewResolver" class="org.springframework.web.servlet.view.InternalResourceViewResolver">
-		<property name="prefix" value="/WEB-INF/jsp/"/>
-		<property name="suffix" value=".jsp"/>
-	</bean>
+    <bean name="/listAccounts.html" class="bigbank.web.ListAccounts">
+        <constructor-arg ref="bankService"/>
+    </bean>
 
-</beans>
+    <bean name="/post.html" class="bigbank.web.PostAccounts">
+        <constructor-arg ref="bankService"/>
+    </bean>
+
+    <bean id="viewResolver" class="org.springframework.web.servlet.view.InternalResourceViewResolver">
+        <property name="prefix" value="/WEB-INF/jsp/"/>
+        <property name="suffix" value=".jsp"/>
+    </bean>
+
+</beans>

+ 0 - 4
taglibs/src/test/java/org/springframework/security/taglibs/authz/AuthorizeTagCustomGrantedAuthorityTests.java

@@ -79,10 +79,6 @@ public class AuthorizeTagCustomGrantedAuthorityTests extends TestCase {
     private static class CustomGrantedAuthority implements GrantedAuthority {
         private final String authority;
 
-        public int compareTo(GrantedAuthority o) {
-            return 0;
-        }
-
         public CustomGrantedAuthority(String authority) {
             this.authority = authority;
         }

+ 1 - 0
web/src/test/java/org/springframework/security/web/authentication/DefaultLoginPageGeneratingFilterTests.java

@@ -42,6 +42,7 @@ public class DefaultLoginPageGeneratingFilterTests {
     }
 
     // Fake OpenID filter (since it's not in this module
+    @SuppressWarnings("unused")
     private static class MockProcessingFilter extends AbstractAuthenticationProcessingFilter {
         protected MockProcessingFilter() {
             super("/someurl");

+ 0 - 4
web/src/test/java/org/springframework/security/web/authentication/switchuser/SwitchUserFilterTests.java

@@ -405,9 +405,5 @@ public class SwitchUserFilterTests {
                 throw new UsernameNotFoundException("Could not find: " + username);
             }
         }
-
-        public void setPassword(String password) {
-            this.password = password;
-        }
     }
 }

+ 3 - 3
web/src/test/java/org/springframework/security/web/authentication/www/DigestAuthenticationFilterTests.java

@@ -297,7 +297,7 @@ public class DigestAuthenticationFilterTests {
                 ((UserDetails) SecurityContextHolder.getContext().getAuthentication().getPrincipal()).getUsername());
         assertFalse(SecurityContextHolder.getContext().getAuthentication().isAuthenticated());
     }
-    
+
     @Test
     public void testNormalOperationWhenPasswordNotAlreadyEncodedAndWithoutReAuthentication() throws Exception {
         String responseDigest = DigestAuthUtils.generateDigest(false, USERNAME, REALM, PASSWORD, "GET",
@@ -313,8 +313,8 @@ public class DigestAuthenticationFilterTests {
         assertEquals(USERNAME,
                 ((UserDetails) SecurityContextHolder.getContext().getAuthentication().getPrincipal()).getUsername());
         assertTrue(SecurityContextHolder.getContext().getAuthentication().isAuthenticated());
-        assertEquals(AuthorityUtils.createAuthorityList("ROLE_ONE","ROLE_TWO"), 
-        		SecurityContextHolder.getContext().getAuthentication().getAuthorities());
+        assertEquals(AuthorityUtils.createAuthorityList("ROLE_ONE","ROLE_TWO"),
+                SecurityContextHolder.getContext().getAuthentication().getAuthorities());
     }
 
     @Test

+ 37 - 37
web/src/test/resources/webxml/NoRoles.web.xml

@@ -1,51 +1,51 @@
 <?xml version="1.0" encoding="UTF-8"?>
 <!DOCTYPE web-app PUBLIC "-//Sun Microsystems, Inc.//DTD Web Application 2.3//EN" "http://java.sun.com/dtd/web-app_2_3.dtd">
 <web-app id="WebApp">
-	<display-name>poc-acegi-web</display-name>
-	<context-param>
-		<param-name>contextConfigLocation</param-name>
-		<param-value>classpath:j2ee-acegi-security.xml</param-value>
-	</context-param>
-	<context-param>
-		<param-name>log4jConfigLocation</param-name>
-		<param-value>/WEB-INF/classes/log4j.properties</param-value>
-	</context-param>
+    <display-name>poc-acegi-web</display-name>
+    <context-param>
+        <param-name>contextConfigLocation</param-name>
+        <param-value>classpath:j2ee-acegi-security.xml</param-value>
+    </context-param>
+    <context-param>
+        <param-name>log4jConfigLocation</param-name>
+        <param-value>/WEB-INF/classes/log4j.properties</param-value>
+    </context-param>
 
     <filter>
         <filter-name>springSecurityFilterChain</filter-name>
         <filter-class>org.springframework.web.filter.DelegatingFilterProxy</filter-class>
     </filter>
-    
+
     <filter-mapping>
         <filter-name>springSecurityFilterChain</filter-name>
         <url-pattern>/*</url-pattern>
     </filter-mapping>
-    
-	<listener>
-		<listener-class>org.springframework.web.util.Log4jConfigListener</listener-class>
-	</listener>
-	<listener>
-		<listener-class>org.springframework.web.context.ContextLoaderListener</listener-class>
-	</listener>
-	<listener>
-		<listener-class>org.acegisecurity.ui.session.HttpSessionEventPublisher</listener-class>
-	</listener>
 
-	<servlet>
-		<servlet-name>dispatch</servlet-name>
-		<servlet-class>org.springframework.web.servlet.DispatcherServlet</servlet-class>
-		<load-on-startup>1</load-on-startup>
-	</servlet>
-	<servlet-mapping>
-		<servlet-name>dispatch</servlet-name>
-		<url-pattern>*.form</url-pattern>
-	</servlet-mapping>
-	<welcome-file-list>
-		<welcome-file>index.html</welcome-file>
-		<welcome-file>index.htm</welcome-file>
-		<welcome-file>index.jsp</welcome-file>
-		<welcome-file>default.html</welcome-file>
-		<welcome-file>default.htm</welcome-file>
-		<welcome-file>default.jsp</welcome-file>
-	</welcome-file-list>
+    <listener>
+        <listener-class>org.springframework.web.util.Log4jConfigListener</listener-class>
+    </listener>
+    <listener>
+        <listener-class>org.springframework.web.context.ContextLoaderListener</listener-class>
+    </listener>
+    <listener>
+        <listener-class>org.acegisecurity.ui.session.HttpSessionEventPublisher</listener-class>
+    </listener>
+
+    <servlet>
+        <servlet-name>dispatch</servlet-name>
+        <servlet-class>org.springframework.web.servlet.DispatcherServlet</servlet-class>
+        <load-on-startup>1</load-on-startup>
+    </servlet>
+    <servlet-mapping>
+        <servlet-name>dispatch</servlet-name>
+        <url-pattern>*.form</url-pattern>
+    </servlet-mapping>
+    <welcome-file-list>
+        <welcome-file>index.html</welcome-file>
+        <welcome-file>index.htm</welcome-file>
+        <welcome-file>index.jsp</welcome-file>
+        <welcome-file>default.html</welcome-file>
+        <welcome-file>default.htm</welcome-file>
+        <welcome-file>default.jsp</welcome-file>
+    </welcome-file-list>
 </web-app>

+ 74 - 74
web/src/test/resources/webxml/Role1-4.web.xml

@@ -1,88 +1,88 @@
 <?xml version="1.0" encoding="UTF-8"?>
 <!DOCTYPE web-app PUBLIC "-//Sun Microsystems, Inc.//DTD Web Application 2.3//EN" "http://java.sun.com/dtd/web-app_2_3.dtd">
 <web-app id="WebApp">
-	<display-name>poc-acegi-web</display-name>
-	<context-param>
-		<param-name>contextConfigLocation</param-name>
-		<param-value>classpath:j2ee-acegi-security.xml</param-value>
-	</context-param>
-	<context-param>
-		<param-name>log4jConfigLocation</param-name>
-		<param-value>/WEB-INF/classes/log4j.properties</param-value>
-	</context-param>
+    <display-name>poc-acegi-web</display-name>
+    <context-param>
+        <param-name>contextConfigLocation</param-name>
+        <param-value>classpath:j2ee-acegi-security.xml</param-value>
+    </context-param>
+    <context-param>
+        <param-name>log4jConfigLocation</param-name>
+        <param-value>/WEB-INF/classes/log4j.properties</param-value>
+    </context-param>
 
     <filter>
         <filter-name>springSecurityFilterChain</filter-name>
         <filter-class>org.springframework.web.filter.DelegatingFilterProxy</filter-class>
     </filter>
-    
+
     <filter-mapping>
         <filter-name>springSecurityFilterChain</filter-name>
         <url-pattern>/*</url-pattern>
     </filter-mapping>
-    
-	<listener>
-		<listener-class>org.springframework.web.util.Log4jConfigListener</listener-class>
-	</listener>
-	<listener>
-		<listener-class>org.springframework.web.context.ContextLoaderListener</listener-class>
-	</listener>
-	<listener>
-		<listener-class>org.acegisecurity.ui.session.HttpSessionEventPublisher</listener-class>
-	</listener>
 
-	<servlet>
-		<servlet-name>dispatch</servlet-name>
-		<servlet-class>org.springframework.web.servlet.DispatcherServlet</servlet-class>
-		<load-on-startup>1</load-on-startup>
-	</servlet>
-	<servlet-mapping>
-		<servlet-name>dispatch</servlet-name>
-		<url-pattern>*.form</url-pattern>
-	</servlet-mapping>
-	<welcome-file-list>
-		<welcome-file>index.html</welcome-file>
-		<welcome-file>index.htm</welcome-file>
-		<welcome-file>index.jsp</welcome-file>
-		<welcome-file>default.html</welcome-file>
-		<welcome-file>default.htm</welcome-file>
-		<welcome-file>default.jsp</welcome-file>
-	</welcome-file-list>
-	<resource-ref id="ResourceRef_1185189465160">
-		<res-ref-name>jms/testQueue</res-ref-name>
-		<res-type>javax.jms.Queue</res-type>
-		<res-auth>Container</res-auth>
-		<res-sharing-scope>Shareable</res-sharing-scope>
-	</resource-ref>
-	<resource-ref id="ResourceRef_1185189465170">
-		<res-ref-name>jms/testQCF</res-ref-name>
-		<res-type>javax.jms.QueueConnectionFactory</res-type>
-		<res-auth>Container</res-auth>
-		<res-sharing-scope>Shareable</res-sharing-scope>
-	</resource-ref>
-	<security-constraint>
-		<web-resource-collection>
-			<web-resource-name>Default</web-resource-name>
-			<url-pattern>/*</url-pattern>
-		</web-resource-collection>
-		<auth-constraint>
-			<role-name>*</role-name>
-		</auth-constraint>
-	</security-constraint>
-	<security-role>
-		<description></description>
-		<role-name>Role1</role-name>
-	</security-role>
-	<security-role>
-		<description></description>
-		<role-name>Role2</role-name>
-	</security-role>
-	<security-role>
-		<description></description>
-		<role-name>Role3</role-name>
-	</security-role>
-	<security-role>
-		<description></description>
-		<role-name>Role4</role-name>
-	</security-role>
+    <listener>
+        <listener-class>org.springframework.web.util.Log4jConfigListener</listener-class>
+    </listener>
+    <listener>
+        <listener-class>org.springframework.web.context.ContextLoaderListener</listener-class>
+    </listener>
+    <listener>
+        <listener-class>org.acegisecurity.ui.session.HttpSessionEventPublisher</listener-class>
+    </listener>
+
+    <servlet>
+        <servlet-name>dispatch</servlet-name>
+        <servlet-class>org.springframework.web.servlet.DispatcherServlet</servlet-class>
+        <load-on-startup>1</load-on-startup>
+    </servlet>
+    <servlet-mapping>
+        <servlet-name>dispatch</servlet-name>
+        <url-pattern>*.form</url-pattern>
+    </servlet-mapping>
+    <welcome-file-list>
+        <welcome-file>index.html</welcome-file>
+        <welcome-file>index.htm</welcome-file>
+        <welcome-file>index.jsp</welcome-file>
+        <welcome-file>default.html</welcome-file>
+        <welcome-file>default.htm</welcome-file>
+        <welcome-file>default.jsp</welcome-file>
+    </welcome-file-list>
+    <resource-ref id="ResourceRef_1185189465160">
+        <res-ref-name>jms/testQueue</res-ref-name>
+        <res-type>javax.jms.Queue</res-type>
+        <res-auth>Container</res-auth>
+        <res-sharing-scope>Shareable</res-sharing-scope>
+    </resource-ref>
+    <resource-ref id="ResourceRef_1185189465170">
+        <res-ref-name>jms/testQCF</res-ref-name>
+        <res-type>javax.jms.QueueConnectionFactory</res-type>
+        <res-auth>Container</res-auth>
+        <res-sharing-scope>Shareable</res-sharing-scope>
+    </resource-ref>
+    <security-constraint>
+        <web-resource-collection>
+            <web-resource-name>Default</web-resource-name>
+            <url-pattern>/*</url-pattern>
+        </web-resource-collection>
+        <auth-constraint>
+            <role-name>*</role-name>
+        </auth-constraint>
+    </security-constraint>
+    <security-role>
+        <description></description>
+        <role-name>Role1</role-name>
+    </security-role>
+    <security-role>
+        <description></description>
+        <role-name>Role2</role-name>
+    </security-role>
+    <security-role>
+        <description></description>
+        <role-name>Role3</role-name>
+    </security-role>
+    <security-role>
+        <description></description>
+        <role-name>Role4</role-name>
+    </security-role>
 </web-app>