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

前端 未结 2 1797
借酒劲吻你
借酒劲吻你 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')")
    

提交回复
热议问题