Possible Duplicate:
How to create custom methods for use in spring security expression language annotations
I wish to use custom methods inside @PreAuthorize
like :
@PreAuthorize("canPlayGolf(something,something)")
For that, I created a replica of MethodSecurityExpressionRoot
(can't subclass it as it has package access in Spring Security 3.0.6) and add my custom functions there. I need to use this custom expression root in MethodSecurityExpressionHandler
, but since it hardcodes MethodSecurityExpressionRoot
, I subclassed it to use my custom expression root (I had to create a replica of MethodSecurityEvaluationContext
too as I had to use it in my override of createEvaluationContext
and it had again package access).
Finally, I can't figure out how to wire my custom expression handler in ExpressionBasedPreInvocationAdvice
, so that I can use my custom expressions in @PreAuthorize