5

我正在尝试通过遵循文档http://static.springsource.org/spring-security/site/docs/3.1.x/reference/security-filter-chain.html#filter-chains来使用 Spring 实现无状态身份验证-with-ns

所以在我的 spring-security.xml 中,我有

<!-- Stateless RESTful service using Basic authentication -->  
<http pattern="/restful/**" create-session="stateless">  
  <intercept-url pattern='/**' access='ROLE_REMOTE' />  
  <http-basic />  
</http>

当我使用浏览器进行测试时,需要对第一个请求进行身份验证。但后面不是。据我了解,我应该看到用户登录提示。有什么我想念的吗?

4

1 回答 1

3

不会。在基本身份验证的情况下,浏览器会记住您输入的凭据并自动将它们与后续请求一起发送。

为了确保您的配置真的是无状态的,您可以尝试使用命令行工具(wget, )发出一些请求(有和没有身份验证curl)。

于 2013-07-09T21:19:56.567 回答