Spring Security @PreAuthorize used to authorize access to methods. He knows little about Spring MVC, in particular about its @RequestMapping annotation.
Names like #cmd will refer to the method parameters, and your cmd parameter is zero. Change it to:
@PathVariable("cmd") String cmd
Thus, the cmd path variable will be bound to the parameter of the cmd method, which will then be bound to #cmd in @PreAuthorize .
source share