【问题标题】:Unable to access OAuth 2.0 access token无法访问 OAuth 2.0 访问令牌
【发布时间】:2015-09-21 23:05:57
【问题描述】:

我是使用 Spring Security 的新手。我想做的是:1 1. 我有一个身份微服务在不同的端口上运行 2. 以及在不同端口上运行的门户服务。

身份服务负责用户身份验证。用户拥有{username, password, Set, organization-info}。

门户服务使用此身份服务对其用户进行身份验证。 我在身份应用程序的SecurityConfiguration 中使用JwtAccessTokenConverterTokenEnhancer。增强器将附加信息(例如用户的组织信息)放在 Oauth2AccessToken 中。

现在我想通过门户服务访问这些附加信息。

如何从门户微服务访问这些附加信息。 我试过SecurityContextHolder.getContext().getAuthentication(),但没有帮助。

如有任何帮助,将不胜感激。

【问题讨论】:

    标签: java spring spring-security oauth-2.0


    【解决方案1】:

    您需要 OAuth2AuthenticationProcessingFilter 来实现 Oauth2 资源服务器。

    查看以下开发指南了解更多信息。 http://projects.spring.io/spring-security-oauth/docs/oauth2.html

    【讨论】: