SEC-428: Tests to prove proxy-target-class="true" works.

This commit is contained in:
Ben Alex
2008-03-24 23:10:01 +00:00
parent f8b5000d40
commit f4eb15b08b
3 changed files with 27 additions and 6 deletions

View File

@@ -13,6 +13,7 @@ import org.springframework.security.util.InMemoryXmlApplicationContext;
* Tests for SEC-428.
*
* @author Luke Taylor
* @author Ben Alex
*/
public class MethodSecurityInterceptorWithAopConfigTests {
static final String AUTH_PROVIDER_XML =
@@ -39,7 +40,8 @@ public class MethodSecurityInterceptorWithAopConfigTests {
@After
public void closeAppContext() {
if (appContext != null) {
SecurityContextHolder.clearContext();
if (appContext != null) {
appContext.close();
appContext = null;
}
@@ -48,7 +50,7 @@ public class MethodSecurityInterceptorWithAopConfigTests {
@Test(expected=AuthenticationCredentialsNotFoundException.class)
public void securityInterceptorIsAppliedWhenUsedWithAopConfig() {
setContext(
"<aop:config>" +
"<aop:config proxy-target-class=\"true\">" +
" <aop:pointcut id='targetMethods' expression='execution(* org.springframework.security.TargetObject.*(..))'/>" +
" <aop:advisor advice-ref='securityInterceptor' pointcut-ref='targetMethods' />" +
"</aop:config>" +
@@ -56,9 +58,9 @@ public class MethodSecurityInterceptorWithAopConfigTests {
"<b:bean id='securityInterceptor' class='org.springframework.security.intercept.method.aopalliance.MethodSecurityInterceptor' autowire='byType' >" +
" <b:property name='objectDefinitionSource'>" +
" <b:value>" +
"org.springframework.security.ITargetObject.makeLower*=ROLE_A\n" +
"org.springframework.security.ITargetObject.makeUpper*=ROLE_A\n" +
"org.springframework.security.ITargetObject.computeHashCode*=ROLE_B\n" +
"org.springframework.security.TargetObject.makeLower*=ROLE_A\n" +
"org.springframework.security.TargetObject.makeUpper*=ROLE_A\n" +
"org.springframework.security.TargetObject.computeHashCode*=ROLE_B\n" +
" </b:value>" +
" </b:property>" +
"</b:bean>" +