I'm trying write an aspectJ pointcut that is called every time an AccessDeniedException is thrown in my webapp. I'm using @PreAuthorize on all my service methods, and I simply want to write to the database each time it returns an AccessDeniedException. I cannot seem to get it right.
I am using compile-time aspectJ weaving. Spring 3.1.0
I have tried these (and more) with no luck. I have other aspects in my app that work with no problem, so my setup should be correct. Any help is greatly appreciated.
Code:@Before("call(org.springframework.security.access.AccessDeniedException.new(..))")Code:@AfterThrowing(pointcut="execution(* *.AffirmativeBased.decide(..))", throwing="ex")Here is my maven plugin for aspectJ.Code:@After("handler(org.springframework.security.access.AccessDeniedException)")
Code:<plugin> <groupId>org.codehaus.mojo</groupId> <artifactId>aspectj-maven-plugin</artifactId> <version>1.4</version> <configuration> <source>1.6</source> <weaveDependencies> <weaveDependency> <groupId>org.springframework.security</groupId> <artifactId>spring-security-web</artifactId> </weaveDependency> <weaveDependency> <groupId>org.springframework.security</groupId> <artifactId>spring-security-core</artifactId> </weaveDependency> </weaveDependencies> <aspectLibraries> <aspectLibrary> <groupId>org.springframework</groupId> <artifactId>spring-aspects</artifactId> </aspectLibrary> </aspectLibraries> </configuration> <executions> <execution> <goals> <goal>compile</goal> <!-- use this goal to weave all your main classes --> </goals> </execution> </executions> </plugin>


Reply With Quote
