Hi, I'm trying to use the @PostAuthorize annotation using EL to compare properties on the return value of a method.
But I'm not having much luck - I'm able to access method return values that my principle should not be able to access:
Config:
Service interface:Code:<global-method-security pre-post-annotations="enabled"> <http use-expressions="true"> <intercept-url pattern="/sites/**" access="hasRole('ROLE_OWNER')" /> <http-basic /> </http>
The Site object has a nested Owner object, which has a Long key property.Code:@PreAuthorize("hasRole('ROLE_OWNER')") public interface SiteService { @PostAuthorize("returnObject.owner.key == principal.key") Site getSite(String siteId); }
The Principle is a custom UserDetails object, which has a Long key property.
Anything I'm missing?
I've verified I do have a correct principle in the context. But I'm able to call the getSite method above, even if my principle's key property does not match the return value's.


