我想添加Spring安全性,但無法使其工作。不過,我會認爲這會導致瀏覽器彈出一個詢問用戶名和密碼的對話框,但沒有顯示任何內容。它只是給我帶來了正常的頁面而沒有強制任何安全性。使用Spring 3.1:無法使Spring安全工作BASIC身份驗證
web.xml
:
<filter>
<filter-name>springSecurityFilterChain</filter-name>
<filter-class>org.springframework.web.filter.DelegatingFilterProxy</filter-class>
</filter>
<filter-mapping>
<filter-name>springSecurityFilterChain</filter-name>
<url-pattern>/*</url-pattern>
</filter-mapping>
context.xml
:
<security:http>
<security:http-basic />
<security:intercept-url pattern="/**" access="ROLE_USER" />
</security:http>
<security:authentication-manager>
<security:authentication-provider>
<security:user-service>
<security:user name="test" password="testpass" authorities="ROLE_USER" />
</security:user-service>
</security:authentication-provider>
</security:authentication-manager>
他試圖使用HTTP基本身份驗證並不構成認證的例子 – cproinger 2013-04-28 18:58:27