我正在尝试Spring Security基本身份验证。我的MVC APP正在运作 很好,我可以输入用户名和密码,直到我在春天下添加 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>
我已删除过滤器标签,并且该标签正在运行。当我再次添加它时,它给我一个错误“原始服务器找不到目标资源的当前表示或不愿意透露该资源的存在。”
我也在spring-security.xml中添加了以下标签。
<security:http>
<security:intercept-url pattern="/login/"
access="ROLE_USER" />
<security:http-basic />
</security:http>
<security:authentication-manager>
<security:authentication-provider>
<security:user-service>
<security:user name="rahul" password="123"
authorities="ROLE_USER" />
</security:user-service>
</security:authentication-provider>
</security:authentication-manager>