SEC-428: Tests to prove proxy-target-class="true" works.
This commit is contained in:
parent
f8b5000d40
commit
f4eb15b08b
|
@ -55,7 +55,6 @@
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>org.aspectj</groupId>
|
<groupId>org.aspectj</groupId>
|
||||||
<artifactId>aspectjweaver</artifactId>
|
<artifactId>aspectjweaver</artifactId>
|
||||||
<version>1.5.4</version>
|
|
||||||
<scope>test</scope>
|
<scope>test</scope>
|
||||||
<optional>true</optional>
|
<optional>true</optional>
|
||||||
</dependency>
|
</dependency>
|
||||||
|
@ -64,6 +63,12 @@
|
||||||
<artifactId>spring-ldap</artifactId>
|
<artifactId>spring-ldap</artifactId>
|
||||||
<optional>true</optional>
|
<optional>true</optional>
|
||||||
</dependency>
|
</dependency>
|
||||||
|
<dependency>
|
||||||
|
<groupId>cglib</groupId>
|
||||||
|
<artifactId>cglib-nodep</artifactId>
|
||||||
|
<scope>test</scope>
|
||||||
|
<optional>true</optional>
|
||||||
|
</dependency>
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>net.sf.ehcache</groupId>
|
<groupId>net.sf.ehcache</groupId>
|
||||||
<artifactId>ehcache</artifactId>
|
<artifactId>ehcache</artifactId>
|
||||||
|
|
|
@ -13,6 +13,7 @@ import org.springframework.security.util.InMemoryXmlApplicationContext;
|
||||||
* Tests for SEC-428.
|
* Tests for SEC-428.
|
||||||
*
|
*
|
||||||
* @author Luke Taylor
|
* @author Luke Taylor
|
||||||
|
* @author Ben Alex
|
||||||
*/
|
*/
|
||||||
public class MethodSecurityInterceptorWithAopConfigTests {
|
public class MethodSecurityInterceptorWithAopConfigTests {
|
||||||
static final String AUTH_PROVIDER_XML =
|
static final String AUTH_PROVIDER_XML =
|
||||||
|
@ -39,7 +40,8 @@ public class MethodSecurityInterceptorWithAopConfigTests {
|
||||||
|
|
||||||
@After
|
@After
|
||||||
public void closeAppContext() {
|
public void closeAppContext() {
|
||||||
if (appContext != null) {
|
SecurityContextHolder.clearContext();
|
||||||
|
if (appContext != null) {
|
||||||
appContext.close();
|
appContext.close();
|
||||||
appContext = null;
|
appContext = null;
|
||||||
}
|
}
|
||||||
|
@ -48,7 +50,7 @@ public class MethodSecurityInterceptorWithAopConfigTests {
|
||||||
@Test(expected=AuthenticationCredentialsNotFoundException.class)
|
@Test(expected=AuthenticationCredentialsNotFoundException.class)
|
||||||
public void securityInterceptorIsAppliedWhenUsedWithAopConfig() {
|
public void securityInterceptorIsAppliedWhenUsedWithAopConfig() {
|
||||||
setContext(
|
setContext(
|
||||||
"<aop:config>" +
|
"<aop:config proxy-target-class=\"true\">" +
|
||||||
" <aop:pointcut id='targetMethods' expression='execution(* org.springframework.security.TargetObject.*(..))'/>" +
|
" <aop:pointcut id='targetMethods' expression='execution(* org.springframework.security.TargetObject.*(..))'/>" +
|
||||||
" <aop:advisor advice-ref='securityInterceptor' pointcut-ref='targetMethods' />" +
|
" <aop:advisor advice-ref='securityInterceptor' pointcut-ref='targetMethods' />" +
|
||||||
"</aop:config>" +
|
"</aop:config>" +
|
||||||
|
@ -56,9 +58,9 @@ public class MethodSecurityInterceptorWithAopConfigTests {
|
||||||
"<b:bean id='securityInterceptor' class='org.springframework.security.intercept.method.aopalliance.MethodSecurityInterceptor' autowire='byType' >" +
|
"<b:bean id='securityInterceptor' class='org.springframework.security.intercept.method.aopalliance.MethodSecurityInterceptor' autowire='byType' >" +
|
||||||
" <b:property name='objectDefinitionSource'>" +
|
" <b:property name='objectDefinitionSource'>" +
|
||||||
" <b:value>" +
|
" <b:value>" +
|
||||||
"org.springframework.security.ITargetObject.makeLower*=ROLE_A\n" +
|
"org.springframework.security.TargetObject.makeLower*=ROLE_A\n" +
|
||||||
"org.springframework.security.ITargetObject.makeUpper*=ROLE_A\n" +
|
"org.springframework.security.TargetObject.makeUpper*=ROLE_A\n" +
|
||||||
"org.springframework.security.ITargetObject.computeHashCode*=ROLE_B\n" +
|
"org.springframework.security.TargetObject.computeHashCode*=ROLE_B\n" +
|
||||||
" </b:value>" +
|
" </b:value>" +
|
||||||
" </b:property>" +
|
" </b:property>" +
|
||||||
"</b:bean>" +
|
"</b:bean>" +
|
||||||
|
|
14
pom.xml
14
pom.xml
|
@ -659,6 +659,13 @@
|
||||||
<artifactId>spring-ldap</artifactId>
|
<artifactId>spring-ldap</artifactId>
|
||||||
<version>1.2.1</version>
|
<version>1.2.1</version>
|
||||||
</dependency>
|
</dependency>
|
||||||
|
<dependency>
|
||||||
|
<groupId>org.aspectj</groupId>
|
||||||
|
<artifactId>aspectjweaver</artifactId>
|
||||||
|
<scope>test</scope>
|
||||||
|
<optional>true</optional>
|
||||||
|
<version>1.5.4</version>
|
||||||
|
</dependency>
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>aspectj</groupId>
|
<groupId>aspectj</groupId>
|
||||||
<artifactId>aspectjrt</artifactId>
|
<artifactId>aspectjrt</artifactId>
|
||||||
|
@ -669,6 +676,13 @@
|
||||||
<artifactId>spring-webmvc</artifactId>
|
<artifactId>spring-webmvc</artifactId>
|
||||||
<version>${spring.version}</version>
|
<version>${spring.version}</version>
|
||||||
</dependency>
|
</dependency>
|
||||||
|
<dependency>
|
||||||
|
<groupId>cglib</groupId>
|
||||||
|
<artifactId>cglib-nodep</artifactId>
|
||||||
|
<scope>test</scope>
|
||||||
|
<optional>true</optional>
|
||||||
|
<version>2.1_3</version>
|
||||||
|
</dependency>
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>log4j</groupId>
|
<groupId>log4j</groupId>
|
||||||
<artifactId>log4j</artifactId>
|
<artifactId>log4j</artifactId>
|
||||||
|
|
Loading…
Reference in New Issue