Hi,
I'm using spring security 3.0.5 with roo. I've been at this for a while now, can't figure it out... so I hope you guys can help.
In one of my Domain classes I added some find methods to the .java file (in addition to the roo generated ones in the .aj file).
Trying to secure them as follows doesn't seem to do anything if using mode="aspectj" in the global method security namespace element. Everything works, but I don't think method security is ever actually applied. Don't see anything in logs...
Trying to use aop instead, method security is applied:Code:@PreAuthorize("ROLE_USER") @PostFilter("hasPermission(filterTarget,role) or hasRole('ROLE_ADMIN')")
but results in:Code:org.springframework.security.access.prepost.PrePostAnnotationSecurityMetadataSource - @org.springframework.security.access.prepost.PreAuthorize(value=ROLE_USER) found on specific method: public static java.util.List x.y.DomainObject.findX() 2011-02-27 10:32:45,728 ["http-bio-8080"-exec-8] DEBUG org.springframework.security.access.prepost.PrePostAnnotationSecurityMetadataSource - @org.springframework.security.access.prepost.PostFilter(value=hasPermission(filterTarget,role) or hasRole('ROLE_ADMIN')) found on specific method: public static java.util.List x.y.DomainObject.findX() 2011-02-27 10:32:45,737 ["http-bio-8080"-exec-8] DEBUG org.springframework.security.access.method.DelegatingMethodSecurityMetadataSource - Adding security method [CacheKey[x.y.DomainObject; public static java.util.List x.y.DomainObject.findX()]] with attributes [[authorize: 'ROLE_USER', filter: 'null', filterTarget: 'null'], [authorize: 'null', filter: 'hasPermission(filterTarget,role) or hasRole('ROLE_ADMIN')']]
So my question is:Code:java.lang.IllegalStateException: Post-processor tried to replace bean instance of type [x.y.DomainObject] with (proxy) object of type [$Proxy134] - not supported for aspect-configured classes!
Is it even possible to secure methods on the same class in the .aj files as well as the .java files?
If not what would be the best way to achieve what I want?
Add my own methods as aspects and only use aspectj mode?
Thanks!


Reply With Quote




