1

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

Community
  • 1
  • 1
Daud
  • 7,429
  • 18
  • 68
  • 115
  • I found the solution here : http://stackoverflow.com/questions/6632982/how-to-create-custom-methods-for-use-in-spring-security-expression-language-anno – Daud Apr 19 '12 at 06:37

0 Answers0