Repository access control in Spring Data Rest based off user princpal

后端 未结 2 2022
广开言路
广开言路 2020-12-24 09:26

I\'m attempting to implement fine grain access control while still taking advantage of Spring data rest.

I\'m working on securing a CrudRepository so u

2条回答
  •  暖寄归人
    2020-12-24 10:02

    Can also be achieved by implementing your checks in your custom Spring repository event handlers. See @HandleBeforeCreate, @HandleBeforeUpdate, @HandleBeforeDelete.

    Alternatively, you can use permission-based expressions, e.g. with ACL or your custom ones, you can write @PreAuthorize("hasPermission(#id, 'MyObject', 'DELETE')").

提交回复
热议问题