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

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

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

@ -4,7 +4,6 @@
<!-- <!--
- Contacts web application - Contacts web application
- Client application context - Client application context
- $Id$
--> -->
<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;
}
} }
} }