作为标题,版本1.1中没有@ EnableOAuth2Resource。 我怎样才能在1.1中实现同样的目标?
根据我在https://github.com/spring-cloud/spring-cloud-security中读到的内容,Spring Cloud 1.1中没有@ EnableOAuth2Resource注释。您只需使用Spring OAuth中的常规@EnableResourecServer。
在我更新到1.1之前,我可以使用@ EnableOAuth2Resource通过在属性文件中提供userInfoUri来检查来自另一个Auth服务器的令牌。它工作正常,直到我更新版本。
spring:
oauth2:
resource:
userInfoUri: http://auth:9003/api/me
preferTokenInfo: false
我更新到1.1后,我只是将@ EnableOAuth2Resource更改为@EnableResourceServer。但是,当我调用受保护的api时,它显示无效的访问令牌。