【发布时间】:2016-07-08 04:20:02
【问题描述】:
我是使用 Spring Session 和 Spring Security 的新手。希望能得到帮助。我想在 REST API 上使用 Spring Session 和 Spring Security,并使用 Redis 来存储会话信息。我遵循了来自http://docs.spring.io/spring-session/docs/current/reference/html5/guides/rest.html 的示例,但我使用 xml 而不是 Java 类,并且我使用的是 Spring 3.2.4。
当我使用带有用户名:密码的curl时没有问题,x-auth-token保存在Redis中,并且在标题中获得200 ok。
但是,当我使用没有用户名和密码的 curl 时遇到问题。获取401未授权但header中返回x-auth-token,也保存在redis中
< HTTP/1.1 401 Unauthorized
* Server Apache-Coyote/1.1 is not blacklisted
< Server: Apache-Coyote/1.1
< x-auth-token: 71554566-17d3-44ca-94b8-009d090c61a1
< Content-Type: text/html;charset=utf-8
< Content-Language: en
< Content-Length: 1018
< Date: Mon, 21 Mar 2016 14:40:18 GMT
【问题讨论】:
标签: spring spring-session