Merge pull request #240 from markfisher/INT-2281

refactored test code for compatibility with Spring Security 3.1
This commit is contained in:
Mark Fisher
2011-12-12 16:58:58 -05:00
3 changed files with 32 additions and 33 deletions

View File

@@ -127,7 +127,7 @@ configure(javaprojects) {
springDataMongoVersion = '1.0.0.RC1'
springDataRedisVersion = '1.0.0.RC1'
springGemfireVersion = '1.1.0.RC1'
springSecurityVersion = '3.0.6.RELEASE'
springSecurityVersion = '3.1.0.RELEASE'
springWsVersion = '2.0.3.RELEASE'
sourceSets {

View File

@@ -88,6 +88,12 @@
</repository>
</repositories>
<dependencies>
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-test</artifactId>
<version>3.0.6.RELEASE</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.springframework.integration</groupId>
<artifactId>spring-integration-core</artifactId>
@@ -96,8 +102,8 @@
</dependency>
<dependency>
<groupId>org.springframework.security</groupId>
<artifactId>spring-security-core</artifactId>
<version>3.0.6.RELEASE</version>
<artifactId>spring-security-config</artifactId>
<version>3.1.0.RELEASE</version>
<scope>compile</scope>
<exclusions>
<exclusion>
@@ -106,12 +112,6 @@
</exclusion>
</exclusions>
</dependency>
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-test</artifactId>
<version>3.0.6.RELEASE</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>cglib</groupId>
<artifactId>cglib-nodep</artifactId>
@@ -136,18 +136,6 @@
<version>2.3</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.springframework.security</groupId>
<artifactId>spring-security-config</artifactId>
<version>3.0.6.RELEASE</version>
<scope>compile</scope>
<exclusions>
<exclusion>
<artifactId>spring-support</artifactId>
<groupId>org.springframework</groupId>
</exclusion>
</exclusions>
</dependency>
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-aop</artifactId>
@@ -172,6 +160,18 @@
<version>1.8.4</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.springframework.security</groupId>
<artifactId>spring-security-core</artifactId>
<version>3.1.0.RELEASE</version>
<scope>compile</scope>
<exclusions>
<exclusion>
<artifactId>spring-support</artifactId>
<groupId>org.springframework</groupId>
</exclusion>
</exclusions>
</dependency>
<dependency>
<groupId>junit</groupId>
<artifactId>junit-dep</artifactId>

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2002-2010 the original author or authors.
* Copyright 2002-2011 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -13,32 +13,31 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.springframework.integration.security;
import org.springframework.security.authentication.AbstractAuthenticationManager;
import org.springframework.security.authentication.AuthenticationManager;
import org.springframework.security.core.Authentication;
import org.springframework.security.core.AuthenticationException;
/**
* @author Oleg Zhurakousky
* @author Mark Fisher
* @since 2.0
*/
public class MockAuthenticationManager extends AbstractAuthenticationManager {
private boolean grantAccess;
public class MockAuthenticationManager implements AuthenticationManager {
private final boolean grantAccess;
public MockAuthenticationManager(boolean grantAccess){
this.grantAccess = grantAccess;
}
/* (non-Javadoc)
* @see org.springframework.security.authentication.AbstractAuthenticationManager#doAuthentication(org.springframework.security.core.Authentication)
*/
@Override
protected Authentication doAuthentication(Authentication authentication)
throws AuthenticationException {
if (grantAccess){
public Authentication authenticate(Authentication authentication) throws AuthenticationException {
if (this.grantAccess) {
authentication.setAuthenticated(true);
}
return authentication;
}
}