![](/img/trans.png)
[英]Configure Spring Security to use custom UsernamePasswordAuthenticationFilter
[英]Configure a custom object in Spring Security
在spring security中是否有任何配置方式,因此,我可以在調用此代碼時獲取自定義的“USER”DAO類對象。
SecurityContextHolder.getContext().getAuthentication().getPrincipal();
使用DaoAuthenticationProvider
執行此操作的最簡單方法
User
dao對象擴展org.springframework.security.core.userdetails.UserDetails
org.springframework.security.core.userdetails.UserDetailsService
並返回您的User
dao對象 UserDetailsService
配置DaoAuthenticationProvider
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.