diff --git a/core/pom.xml b/core/pom.xml index a1feb97c3c..d601dce7de 100644 --- a/core/pom.xml +++ b/core/pom.xml @@ -52,6 +52,13 @@ aspectjrt true + + org.aspectj + aspectjweaver + 1.5.4 + test + true + org.springframework.ldap spring-ldap diff --git a/core/src/main/java/org/springframework/security/util/InMemoryXmlApplicationContext.java b/core/src/main/java/org/springframework/security/util/InMemoryXmlApplicationContext.java index 37559c2cba..8c27f75d5f 100644 --- a/core/src/main/java/org/springframework/security/util/InMemoryXmlApplicationContext.java +++ b/core/src/main/java/org/springframework/security/util/InMemoryXmlApplicationContext.java @@ -11,8 +11,10 @@ public class InMemoryXmlApplicationContext extends AbstractXmlApplicationContext private static final String BEANS_OPENING = "\n"; private static final String BEANS_CLOSE = "\n"; diff --git a/core/src/test/java/org/springframework/security/intercept/method/aopalliance/MethodSecurityInterceptorWithAopConfigTests.java b/core/src/test/java/org/springframework/security/intercept/method/aopalliance/MethodSecurityInterceptorWithAopConfigTests.java new file mode 100644 index 0000000000..9f812ebf3a --- /dev/null +++ b/core/src/test/java/org/springframework/security/intercept/method/aopalliance/MethodSecurityInterceptorWithAopConfigTests.java @@ -0,0 +1,68 @@ +package org.springframework.security.intercept.method.aopalliance; + +import org.junit.After; +import org.junit.Test; +import org.springframework.context.support.AbstractXmlApplicationContext; +import org.springframework.security.ITargetObject; +import org.springframework.security.util.InMemoryXmlApplicationContext; + +/** + * Tests for SEC-428. + * + * @author Luke Taylor + * + */ +public class MethodSecurityInterceptorWithAopConfigTests { + static final String AUTH_PROVIDER_XML = + " " + + " " + + " " + + " " + + " " + + " "; + + static final String ACCESS_MANAGER_XML = + "" + + " " + + " " + + " " + + ""; + + private AbstractXmlApplicationContext appContext; + + @After + public void closeAppContext() { + if (appContext != null) { + appContext.close(); + appContext = null; + } + } + + @Test + public void securityInterceptorIsAppliedWhenUsedWithAopConfig() { + setContext( + "" + + " " + + " " + + "" + + "" + + "" + + " " + + " " + + "org.springframework.security.ITargetObject.makeLower*=ROLE_A\n" + + "org.springframework.security.ITargetObject.makeUpper*=ROLE_A\n" + + "org.springframework.security.ITargetObject.computeHashCode*=ROLE_B\n" + + " " + + " " + + "" + + AUTH_PROVIDER_XML + ACCESS_MANAGER_XML); + + ITargetObject target = (ITargetObject) appContext.getBean("target"); + target.makeLowerCase("TEST"); + + } + + private void setContext(String context) { + appContext = new InMemoryXmlApplicationContext(context); + } +} diff --git a/pom.xml b/pom.xml index 7f242602b9..3f1442b6e1 100644 --- a/pom.xml +++ b/pom.xml @@ -662,7 +662,7 @@ aspectj aspectjrt - 1.5.3 + 1.5.4 org.springframework