spring security : Why can't we access Hibernate entitiy parameters in @PreAuthorize?

前端 未结 4 1968
傲寒
傲寒 2021-01-19 19:34

I have the following interface method on which I am applying @PreAuthorize :

@PreAuthorize(\"doSomething(#user.id)\")
void something(User user,          


        
4条回答
  •  清酒与你
    2021-01-19 20:16

    Spring Security has a better answer for this problem now:

    http://docs.spring.io/spring-security/site/docs/3.2.5.RELEASE/reference/htmlsingle/#access-control-using-preauthorize-and-postauthorize

    Basically, you can use the @P annotation or @Param annotation if you are using < JDK 8.

提交回复
热议问题