Spring安全OAuth检查访问令牌的有效性



我遵循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和secret.

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”}

我不知道出了什么问题。

尝试使用/check_token授权权限:

public class OAuthSecurityConfig extends AuthorizationServerConfigurerAdapter {
   @Override 
   public void configure(AuthorizationServerSecurityConfigurer oauthServer) throws Exception { 
       oauthServer.checkTokenAccess("permitAll()"); 
   }
}

最新更新