Announcement Announcement Module
Collapse
No announcement yet.
Reference method arguments by position in method security expressions? Page Title Module
Move Remove Collapse
X
Conversation Detail Module
Collapse
  • Filter
  • Time
  • Show
Clear All
new posts

  • Reference method arguments by position in method security expressions?

    As per the documentation, you can reference method arguments in your expression as this:

    Code:
    @PreAuthorize("#contact.name == authentication.name")
    public void doSomething(Contact contact, ...) {
    }
    For this to work, I'm pretty sure you would need to have debugging symbols into your compiled code in order for Spring to find the named variables.

    The question is: Is there a way to reference the method's arguments by position instead of by name?

    something like
    Code:
    @PreAuthorize("hasPermission(#args[0].name, 'admin')")
Working...
X