Browse Source

Tidying

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

2
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 * @author Andrei Stefan
*/ */
@SuppressWarnings("unused")
public class ObjectIdentityImplTests { public class ObjectIdentityImplTests {
private static final String DOMAIN_CLASS = private static final String DOMAIN_CLASS =
@ -174,7 +175,6 @@ public class ObjectIdentityImplTests {
} }
} }
@SuppressWarnings("unused")
private class MockOtherIdDomainObject { private class MockOtherIdDomainObject {
private Object id; private Object id;

10
acl/src/test/java/org/springframework/security/acls/domain/ObjectIdentityRetrievalStrategyImplTests.java

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

2
config/src/main/java/org/springframework/security/config/http/RememberMeBeanDefinitionParser.java

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

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

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

2
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); assertEquals(1, appContext.getBeanNamesForType(ApplicationListener.class).length);
appContext.publishEvent(new AuthenticationSuccessEvent(new TestingAuthenticationToken("user", ""))); appContext.publishEvent(new AuthenticationSuccessEvent(new TestingAuthenticationToken("user", "")));
assertTrue(target instanceof ApplicationListener); assertTrue(target instanceof ApplicationListener<?>);
} }
@Test @Test

3
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) { } else if (mi.getArguments().length == 1) {
Object arg = mi.getArguments()[0]; Object arg = mi.getArguments()[0];
if (arg.getClass().isArray() || if (arg.getClass().isArray() || arg instanceof Collection<?>) {
arg instanceof Collection) {
filterTarget = arg; filterTarget = arg;
} }
if (filterTarget == null) { if (filterTarget == null) {

2
core/src/main/java/org/springframework/security/core/authority/mapping/MapBasedAttributes2GrantedAuthoritiesMapper.java

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

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>

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>

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>

10
core/src/test/java/org/springframework/security/access/hierarchicalroles/TestHelperTests.java

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

1
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)); assertEquals(ROLE_B, mds.getAttributes(someMethodString, MockService.class));
} }
@SuppressWarnings("unused")
private class MockService { private class MockService {
public void someMethod(String s) { public void someMethod(String s) {
} }

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

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

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

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

164
core/src/test/java/org/springframework/security/remoting/dns/JndiDnsResolverTest.java

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

113
samples/contacts/client/clientContext.xml

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

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

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

12
samples/dms/src/main/resources/applicationContext-dms-shared.xml

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

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

@ -4,17 +4,17 @@
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" 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"> 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"> <bean name="/listAccounts.html" class="bigbank.web.ListAccounts">
<constructor-arg ref="bankService"/> <constructor-arg ref="bankService"/>
</bean> </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>
</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>

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 static class CustomGrantedAuthority implements GrantedAuthority {
private final String authority; private final String authority;
public int compareTo(GrantedAuthority o) {
return 0;
}
public CustomGrantedAuthority(String authority) { public CustomGrantedAuthority(String authority) {
this.authority = authority; this.authority = authority;
} }

1
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 // Fake OpenID filter (since it's not in this module
@SuppressWarnings("unused")
private static class MockProcessingFilter extends AbstractAuthenticationProcessingFilter { private static class MockProcessingFilter extends AbstractAuthenticationProcessingFilter {
protected MockProcessingFilter() { protected MockProcessingFilter() {
super("/someurl"); super("/someurl");

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); throw new UsernameNotFoundException("Could not find: " + username);
} }
} }
public void setPassword(String password) {
this.password = password;
}
} }
} }

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

74
web/src/test/resources/webxml/NoRoles.web.xml

@ -1,51 +1,51 @@
<?xml version="1.0" encoding="UTF-8"?> <?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"> <!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"> <web-app id="WebApp">
<display-name>poc-acegi-web</display-name> <display-name>poc-acegi-web</display-name>
<context-param> <context-param>
<param-name>contextConfigLocation</param-name> <param-name>contextConfigLocation</param-name>
<param-value>classpath:j2ee-acegi-security.xml</param-value> <param-value>classpath:j2ee-acegi-security.xml</param-value>
</context-param> </context-param>
<context-param> <context-param>
<param-name>log4jConfigLocation</param-name> <param-name>log4jConfigLocation</param-name>
<param-value>/WEB-INF/classes/log4j.properties</param-value> <param-value>/WEB-INF/classes/log4j.properties</param-value>
</context-param> </context-param>
<filter> <filter>
<filter-name>springSecurityFilterChain</filter-name> <filter-name>springSecurityFilterChain</filter-name>
<filter-class>org.springframework.web.filter.DelegatingFilterProxy</filter-class> <filter-class>org.springframework.web.filter.DelegatingFilterProxy</filter-class>
</filter> </filter>
<filter-mapping> <filter-mapping>
<filter-name>springSecurityFilterChain</filter-name> <filter-name>springSecurityFilterChain</filter-name>
<url-pattern>/*</url-pattern> <url-pattern>/*</url-pattern>
</filter-mapping> </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> <listener>
<servlet-name>dispatch</servlet-name> <listener-class>org.springframework.web.util.Log4jConfigListener</listener-class>
<servlet-class>org.springframework.web.servlet.DispatcherServlet</servlet-class> </listener>
<load-on-startup>1</load-on-startup> <listener>
</servlet> <listener-class>org.springframework.web.context.ContextLoaderListener</listener-class>
<servlet-mapping> </listener>
<servlet-name>dispatch</servlet-name> <listener>
<url-pattern>*.form</url-pattern> <listener-class>org.acegisecurity.ui.session.HttpSessionEventPublisher</listener-class>
</servlet-mapping> </listener>
<welcome-file-list>
<welcome-file>index.html</welcome-file> <servlet>
<welcome-file>index.htm</welcome-file> <servlet-name>dispatch</servlet-name>
<welcome-file>index.jsp</welcome-file> <servlet-class>org.springframework.web.servlet.DispatcherServlet</servlet-class>
<welcome-file>default.html</welcome-file> <load-on-startup>1</load-on-startup>
<welcome-file>default.htm</welcome-file> </servlet>
<welcome-file>default.jsp</welcome-file> <servlet-mapping>
</welcome-file-list> <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> </web-app>

148
web/src/test/resources/webxml/Role1-4.web.xml

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

Loading…
Cancel
Save