【发布时间】:2015-10-14 11:54:39
【问题描述】:
我正在关注Spring Security OAuth 的示例代码。
当我尝试检查令牌时获得访问令牌后
curl -X POST http://localhost:9999/uaa/oauth/check_token -d "token=e3f44c4f-f8f2-45c4-9f9e-c7dd1f583a1f"
我收到以下错误:
{"error":"unauthorized","error_description":"Full authentication is required to access this resource"}
我尝试传递客户端 ID 和密码。
curl -X POST acme:acmesecret@localhost:9999/uaa/oauth/check_token -d "token=e3f44c4f-f8f2-45c4-9f9e-c7dd1f583a1f"
我得到 403 状态。
{"timestamp":1437683976536,"status":403,"error":"Forbidden","message":"Access is denied","path":"/uaa/oauth/check_token”}
我无法弄清楚出了什么问题。 非常感谢这里的任何帮助。
【问题讨论】:
-
您能否具体说明
../uaa/oauth/check_token的定义是什么?我问是因为没有这样的标准端点.. -
验证访问令牌的是
/oauth/check_token。/uaa/只是 contextPath。 -
它到底是做什么的?如果你已经有一个令牌,为什么你必须验证它?如果
check_token端点已经使用 oauth 进行保护,那么您必须在请求中提供 Authentication 标头而不是参数...此标头应该是:Authentication: Bearer YOUR_TOKEN -
check_token不受 oauth 保护。请查看上面帖子中的链接以获取有关其使用的更多信息
标签: spring spring-security spring-security-oauth2