我試過通過XML配置Spring Security一段時間了,但我似乎無法讓它工作。以下是我迄今爲止:XML中的Spring Security 3配置
我發現<?xml version="1.0" encoding="UTF-8"?>
<beans xmlns="http://www.springframework.org/schema/beans"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:context="http://www.springframework.org/schema/context"
xmlns:mvc="http://www.springframework.org/schema/mvc"
xmlns:security="http://www.springframework.org/schema/security"
xsi:schemaLocation="http://www.springframework.org/schema/mvc
http://www.springframework.org/schema/mvc/spring-mvc-3.0.xsd
http://www.springframework.org/schema/beans
http://www.springframework.org/schema/beans/spring-beans-3.0.xsd
http://www.springframework.org/schema/context
http://www.springframework.org/schema/context/spring-context-3.0.xsd
http://www.springframework.org/schema/security
http://www.springframework.org/schema/security/spring-security-3.0.xsd">
[...]
<security:http auto-config="true">
<security:intercept-url pattern="/**" access="ROLE_USER" />
<security:http-basic />
</security:http>
<security:authentication-manager>
<security:authentication-provider>
[???] <!-- What goes here? -->
</security:authentication-provider>
</security:authentication-manager>
</beans>
所有教程似乎要我把<user-service>
的佔位符,而NetBeans將不會自動完成該元素。類似這個元素的唯一的東西是any-user-service
,據我所知,它是一個「抽象」元素。
我只想配置內存中的用戶和密碼列表。我如何在Spring Security 3中做到這一點?
謝謝,但正如我在我的問題中解釋的那樣,「用戶服務」在該位置似乎並不是一個有效的元素。我認爲這可能是Spring Security的一個相對較新的變化。 – damd