> For the complete documentation index, see [llms.txt](https://potoyang.gitbook.io/spring-in-action-v5/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://potoyang.gitbook.io/spring-in-action-v5/di-4-zhang-spring-an-quan/4.5-xiao-jie.md).

# 4.5 小结

* Spring Security 自动配置是一种很好的开始学习安全的方式，但大多数应用程序需要明确地配置安全，以满足其独特的安全需求。
* 用户细节可以在关系数据库、LDAP 或完全自定义实现支持的用户存储中进行管理。
* Spring Security 自动防御 CSRF 攻击。
* 通过 SecurityContext 对象（从 SecurityContextHolder. getcontext() 中返回）或使用 @AuthenticationPrincipal 注入控制器中，可以获得认证用户的信息。
