2
是否可以在Spring Security的文件中存儲和修改用戶憑證?在Spring Security中從文件讀取/添加用戶憑證
現在我的security.xml:
<beans:beans xmlns="http://www.springframework.org/schema/security"
xmlns:beans="http://www.springframework.org/schema/beans"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://www.springframework.org/schema/beans
http://www.springframework.org/schema/beans/spring-beans-3.0.xsd
http://www.springframework.org/schema/security
http://www.springframework.org/schema/security/spring-security.xsd">
<http>
<intercept-url pattern="/**" access="ROLE_USER" />
<form-login />
<logout />
</http>
<authentication-manager>
<authentication-provider>
<user-service>
<user name="admin" password="admin" authorities="ROLE_USER, ROLE_ADMIN" />
<user name="user" password="user" authorities="ROLE_USER" />
</user-service>
</authentication-provider>
</authentication-manager>
所有我想要的是存儲在像users.txt或users.xml中有可能性的文件信息,添加或修改用戶/密碼在飛行中。
非常感謝,但登錄表單不顯示,我應該添加一些東西到我的web.xml或applicationContext.xml? (現在我只需將security.xml導入到applicationContext中) –
@zelenov aleksey在applicationContext.xml中提到了bean,並且工作正常! –