小编Kri*_*nan的帖子

如何在@Preauthorize中使用路径变量

我有一种情况,我需要将路径变量作为参数传递给预授权

    @RequestMapping(value="/page/{cmd}", method = RequestMethod.GET)
    @PreAuthorize("hasRole(#cmd)") 
     public void method(@PathVariable String cmd, HttpServletRequest request,  HttpServletResponse response){
// my stuff
}
Run Code Online (Sandbox Code Playgroud)

它没有工作.任何人都建议我如何在预授权中使用路径变量.

spring-security java-ee pre-authentication

9
推荐指数
1
解决办法
2173
查看次数