[英]Spring Security passepartout password
我有一個使用Spring的客戶端/服務器應用程序,更具體地說是使用Spring Security來管理客戶端的身份驗證。 一切正常,這是配置的相關部分:
<security:authentication-manager id="authenticationManager">
<security:authentication-provider>
<security:password-encoder hash="md5" />
<security:jdbc-user-service data-source-ref="dataSource" users-by-username-query="
select username,password,attivo
from Operatore where username=?"
authorities-by-username-query="
select username,ruolo
from Operatore where username=? " />
</security:authentication-provider>
</security:authentication-manager>
我的問題是,是否有一種方法可以授權使用passepartout密碼的用戶。 我的意思是,有時可以使用超級管理員密碼輕松地與特定用戶一起登錄軟件,以便在不更改密碼的情況下查看用戶所看到的內容。
我認為從Spring開始就不會考慮這種行為。 有沒有辦法實現這種行為?
您可以簡單地通過連接自己的AuthenticationProvider實現並根據需要實現authenticate方法來編寫自己的Authentication邏輯:
進一步閱讀:
http://www.baeldung.com/spring-security-authentication-provider
https://danielkaes.wordpress.com/2013/02/20/custom-authentication-provider-in-spring/
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.