From 2fc4abfaed36ff2e0f08c5357a315f133d95c09f Mon Sep 17 00:00:00 2001 From: Mark Fisher Date: Mon, 12 Dec 2011 15:36:24 -0500 Subject: [PATCH] refactored test code for compatibility with Spring Security 3.1 updated pom --- build.gradle | 2 +- spring-integration-security/pom.xml | 40 +++++++++---------- .../security/MockAuthenticationManager.java | 23 +++++------ 3 files changed, 32 insertions(+), 33 deletions(-) diff --git a/build.gradle b/build.gradle index 4326895804..d02253a16c 100644 --- a/build.gradle +++ b/build.gradle @@ -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 { diff --git a/spring-integration-security/pom.xml b/spring-integration-security/pom.xml index efd3ff5004..e5c87fc38b 100644 --- a/spring-integration-security/pom.xml +++ b/spring-integration-security/pom.xml @@ -88,6 +88,12 @@ + + org.springframework + spring-test + 3.0.6.RELEASE + test + org.springframework.integration spring-integration-core @@ -96,8 +102,8 @@ org.springframework.security - spring-security-core - 3.0.6.RELEASE + spring-security-config + 3.1.0.RELEASE compile @@ -106,12 +112,6 @@ - - org.springframework - spring-test - 3.0.6.RELEASE - test - cglib cglib-nodep @@ -136,18 +136,6 @@ 2.3 test - - org.springframework.security - spring-security-config - 3.0.6.RELEASE - compile - - - spring-support - org.springframework - - - org.springframework spring-aop @@ -172,6 +160,18 @@ 1.8.4 test + + org.springframework.security + spring-security-core + 3.1.0.RELEASE + compile + + + spring-support + org.springframework + + + junit junit-dep diff --git a/spring-integration-security/src/test/java/org/springframework/integration/security/MockAuthenticationManager.java b/spring-integration-security/src/test/java/org/springframework/integration/security/MockAuthenticationManager.java index 252ddb5ce0..a8638faf27 100644 --- a/spring-integration-security/src/test/java/org/springframework/integration/security/MockAuthenticationManager.java +++ b/spring-integration-security/src/test/java/org/springframework/integration/security/MockAuthenticationManager.java @@ -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; } + }