How to implement row-level security in Java?

前端 未结 3 1221
耶瑟儿~
耶瑟儿~ 2021-01-05 00:00

I am currently evaluating authentication / authorization frameworks.

Apache Shiro seems to be very nice but I am missing row-level security features

3条回答
  •  攒了一身酷
    2021-01-05 00:25

    There is a helpful article: http://mattfleming.com/node/243

    The idea is that you can implement row level functionality in two ways: directly setting restrictions in your repository or binding the restrictions via AOP. The latter is preferred because security layer should be separated from business logic (orthogonal concerns).

    In Hibernate you can use the concept of filters which are applied transparently and repository doesn't know about them. You can add such filters via AOP. The other way is intercepting session.createCriteria() and adding Restrictions to the Criteria transparently using AOP.

提交回复
热议问题