请翻译: Let’s start by considering Catalog Service where the data layer is implemented with Spring Data JDBC In chapter 5 you learned how to enable JDBC data auditing and you configured it to save both t
让我们首先考虑目录服务,其中数据层使用Spring Data JDBC实现。在第5章中,您学习了如何启用JDBC数据审计,并配置它以保存每个数据实体的创建日期和最后修改日期。在此基础上,我们现在可以扩展审计范围,包括创建实体的人员和最后修改实体的人员的用户名。
首先,我们需要告诉Spring Data从哪里获取关于当前已验证用户的信息。在前一章中,您学习到Spring Security将关于已验证用户的信息存储在Authentication对象中,该对象存储在通过SecurityContextHolder可用的SecurityContext对象中。我们可以使用该对象层次结构来指定如何提取Spring Data的主体。
原文地址: https://www.cveoy.top/t/topic/ir1R 著作权归作者所有。请勿转载和采集!