How to deal with defaultRolePrefix=“ROLE_” in Spring Security update from 3.2.7 to 4.0.2.RELEASE

前端 未结 2 1791
借酒劲吻你
借酒劲吻你 2021-01-04 07:35

My Spring Boot application works on Spring Security 3.2.7.RELEASE. Now, I\'d like to update it to 4.0.2.RELEASE.

After hours of debug I ha

相关标签:
2条回答
  • 2021-01-04 08:09

    I found the solution how to fix it. I need to change hasRole to hasAuthority, for example:

    @PreAuthorize("hasAuthority('PERMISSION_CREATE_NODE')")
    
    0 讨论(0)
  • 2021-01-04 08:23

    In the other hand you can remove role prefix ass described here. In this cas you are free to use other annotations.

    0 讨论(0)
提交回复
热议问题