This commit is contained in:
Luke Taylor 2010-01-02 19:53:19 +00:00
parent b737fa451d
commit 893f212fa5
25 changed files with 323 additions and 473 deletions

View File

@ -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;

View File

@ -27,7 +27,7 @@ public class ObjectIdentityRetrievalStrategyImplTests extends TestCase {
} }
//~ Inner Classes ================================================================================================== //~ Inner Classes ==================================================================================================
@SuppressWarnings("unused")
private class MockIdDomainObject { private class MockIdDomainObject {
private Object id; private Object id;

View File

@ -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) {

View File

@ -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");

View File

@ -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

View File

@ -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) {

View File

@ -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);

View File

@ -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>

View File

@ -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>

View File

@ -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>

View File

@ -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

View File

@ -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) {
} }

View File

@ -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) {
} }

View File

@ -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;
} }

View File

@ -37,84 +37,84 @@ import org.junit.Test;
*/ */
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;
} }
} }

View File

@ -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>

View File

@ -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>

View File

@ -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>

View File

@ -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"> <bean name="/post.html" class="bigbank.web.PostAccounts">
<constructor-arg ref="bankService"/> <constructor-arg ref="bankService"/>
</bean> </bean>
<bean id="viewResolver" class="org.springframework.web.servlet.view.InternalResourceViewResolver"> <bean id="viewResolver" class="org.springframework.web.servlet.view.InternalResourceViewResolver">
<property name="prefix" value="/WEB-INF/jsp/"/> <property name="prefix" value="/WEB-INF/jsp/"/>
<property name="suffix" value=".jsp"/> <property name="suffix" value=".jsp"/>
</bean> </bean>
</beans> </beans>

View File

@ -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;
} }

View File

@ -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");

View File

@ -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;
}
} }
} }

View File

@ -314,7 +314,7 @@ public class DigestAuthenticationFilterTests {
((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

View File

@ -1,15 +1,15 @@
<?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>
@ -21,31 +21,31 @@
<url-pattern>/*</url-pattern> <url-pattern>/*</url-pattern>
</filter-mapping> </filter-mapping>
<listener> <listener>
<listener-class>org.springframework.web.util.Log4jConfigListener</listener-class> <listener-class>org.springframework.web.util.Log4jConfigListener</listener-class>
</listener> </listener>
<listener> <listener>
<listener-class>org.springframework.web.context.ContextLoaderListener</listener-class> <listener-class>org.springframework.web.context.ContextLoaderListener</listener-class>
</listener> </listener>
<listener> <listener>
<listener-class>org.acegisecurity.ui.session.HttpSessionEventPublisher</listener-class> <listener-class>org.acegisecurity.ui.session.HttpSessionEventPublisher</listener-class>
</listener> </listener>
<servlet> <servlet>
<servlet-name>dispatch</servlet-name> <servlet-name>dispatch</servlet-name>
<servlet-class>org.springframework.web.servlet.DispatcherServlet</servlet-class> <servlet-class>org.springframework.web.servlet.DispatcherServlet</servlet-class>
<load-on-startup>1</load-on-startup> <load-on-startup>1</load-on-startup>
</servlet> </servlet>
<servlet-mapping> <servlet-mapping>
<servlet-name>dispatch</servlet-name> <servlet-name>dispatch</servlet-name>
<url-pattern>*.form</url-pattern> <url-pattern>*.form</url-pattern>
</servlet-mapping> </servlet-mapping>
<welcome-file-list> <welcome-file-list>
<welcome-file>index.html</welcome-file> <welcome-file>index.html</welcome-file>
<welcome-file>index.htm</welcome-file> <welcome-file>index.htm</welcome-file>
<welcome-file>index.jsp</welcome-file> <welcome-file>index.jsp</welcome-file>
<welcome-file>default.html</welcome-file> <welcome-file>default.html</welcome-file>
<welcome-file>default.htm</welcome-file> <welcome-file>default.htm</welcome-file>
<welcome-file>default.jsp</welcome-file> <welcome-file>default.jsp</welcome-file>
</welcome-file-list> </welcome-file-list>
</web-app> </web-app>

View File

@ -1,15 +1,15 @@
<?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>
@ -21,68 +21,68 @@
<url-pattern>/*</url-pattern> <url-pattern>/*</url-pattern>
</filter-mapping> </filter-mapping>
<listener> <listener>
<listener-class>org.springframework.web.util.Log4jConfigListener</listener-class> <listener-class>org.springframework.web.util.Log4jConfigListener</listener-class>
</listener> </listener>
<listener> <listener>
<listener-class>org.springframework.web.context.ContextLoaderListener</listener-class> <listener-class>org.springframework.web.context.ContextLoaderListener</listener-class>
</listener> </listener>
<listener> <listener>
<listener-class>org.acegisecurity.ui.session.HttpSessionEventPublisher</listener-class> <listener-class>org.acegisecurity.ui.session.HttpSessionEventPublisher</listener-class>
</listener> </listener>
<servlet> <servlet>
<servlet-name>dispatch</servlet-name> <servlet-name>dispatch</servlet-name>
<servlet-class>org.springframework.web.servlet.DispatcherServlet</servlet-class> <servlet-class>org.springframework.web.servlet.DispatcherServlet</servlet-class>
<load-on-startup>1</load-on-startup> <load-on-startup>1</load-on-startup>
</servlet> </servlet>
<servlet-mapping> <servlet-mapping>
<servlet-name>dispatch</servlet-name> <servlet-name>dispatch</servlet-name>
<url-pattern>*.form</url-pattern> <url-pattern>*.form</url-pattern>
</servlet-mapping> </servlet-mapping>
<welcome-file-list> <welcome-file-list>
<welcome-file>index.html</welcome-file> <welcome-file>index.html</welcome-file>
<welcome-file>index.htm</welcome-file> <welcome-file>index.htm</welcome-file>
<welcome-file>index.jsp</welcome-file> <welcome-file>index.jsp</welcome-file>
<welcome-file>default.html</welcome-file> <welcome-file>default.html</welcome-file>
<welcome-file>default.htm</welcome-file> <welcome-file>default.htm</welcome-file>
<welcome-file>default.jsp</welcome-file> <welcome-file>default.jsp</welcome-file>
</welcome-file-list> </welcome-file-list>
<resource-ref id="ResourceRef_1185189465160"> <resource-ref id="ResourceRef_1185189465160">
<res-ref-name>jms/testQueue</res-ref-name> <res-ref-name>jms/testQueue</res-ref-name>
<res-type>javax.jms.Queue</res-type> <res-type>javax.jms.Queue</res-type>
<res-auth>Container</res-auth> <res-auth>Container</res-auth>
<res-sharing-scope>Shareable</res-sharing-scope> <res-sharing-scope>Shareable</res-sharing-scope>
</resource-ref> </resource-ref>
<resource-ref id="ResourceRef_1185189465170"> <resource-ref id="ResourceRef_1185189465170">
<res-ref-name>jms/testQCF</res-ref-name> <res-ref-name>jms/testQCF</res-ref-name>
<res-type>javax.jms.QueueConnectionFactory</res-type> <res-type>javax.jms.QueueConnectionFactory</res-type>
<res-auth>Container</res-auth> <res-auth>Container</res-auth>
<res-sharing-scope>Shareable</res-sharing-scope> <res-sharing-scope>Shareable</res-sharing-scope>
</resource-ref> </resource-ref>
<security-constraint> <security-constraint>
<web-resource-collection> <web-resource-collection>
<web-resource-name>Default</web-resource-name> <web-resource-name>Default</web-resource-name>
<url-pattern>/*</url-pattern> <url-pattern>/*</url-pattern>
</web-resource-collection> </web-resource-collection>
<auth-constraint> <auth-constraint>
<role-name>*</role-name> <role-name>*</role-name>
</auth-constraint> </auth-constraint>
</security-constraint> </security-constraint>
<security-role> <security-role>
<description></description> <description></description>
<role-name>Role1</role-name> <role-name>Role1</role-name>
</security-role> </security-role>
<security-role> <security-role>
<description></description> <description></description>
<role-name>Role2</role-name> <role-name>Role2</role-name>
</security-role> </security-role>
<security-role> <security-role>
<description></description> <description></description>
<role-name>Role3</role-name> <role-name>Role3</role-name>
</security-role> </security-role>
<security-role> <security-role>
<description></description> <description></description>
<role-name>Role4</role-name> <role-name>Role4</role-name>
</security-role> </security-role>
</web-app> </web-app>