【问题标题】:Multiple Authorization Server多授权服务器
【发布时间】:2017-11-17 14:14:33
【问题描述】:

我有一个 Zuul 代理,它在其背后托管所有微服务,包括 UI 和授权服务器。

都是春云的一部分。

我尝试启动第二个授权服务器,但导致以下错误

2017-11-17 08:07:47.146  INFO 9652 --- [http-nio-9191-exec-2] o.s.s.o.p.token.store.JdbcTokenStore     : Failed to find access token for token 08fa5f86-4bbd-4e5b-818b-a79730232f30
2017-11-17 08:07:47.146 DEBUG 9652 --- [http-nio-9191-exec-2] p.a.OAuth2AuthenticationProcessingFilter : Authentication request failed: error="invalid_token", error_description="Invalid access token: 08fa5f86-4bbd-4e5b-818b-a79730232f30"
2017-11-17 08:07:47.147 DEBUG 9652 --- [http-nio-9191-exec-2] s.s.o.p.e.DefaultOAuth2ExceptionRenderer : Written [error="invalid_token", error_description="Invalid access token: 08fa5f86-4bbd-4e5b-818b-a79730232f30"] as "application/json;charset=UTF-8" using [org.springframework.http.converter.json.MappingJackson2HttpMessageConverter@3c3df936]

还有

2017-11-17 07:39:51.151 DEBUG 9652 --- [http-nio-9191-exec-3] o.s.s.o.provider.endpoint.TokenEndpoint  : Clearing scope of incoming token request
2017-11-17 07:39:51.178 DEBUG 9652 --- [http-nio-9191-exec-3] .s.s.o.p.c.AuthorizationCodeTokenGranter : Getting access token for: acme
2017-11-17 07:39:51.204  INFO 9652 --- [http-nio-9191-exec-3] o.s.s.o.provider.endpoint.TokenEndpoint  : Handling error: InvalidGrantException, Invalid authorization code: Pb3JKA
2017-11-17 07:40:04.797 DEBUG 9652 --- [http-nio-9191-exec-4] .s.o.p.e.FrameworkEndpointHandlerMapping : Looking up handler method for path /oauth/token
2017-11-17 07:40:04.797 DEBUG 9652 --- [http-nio-9191-exec-4] .s.o.p.e.FrameworkEndpointHandlerMapping : Returning handler method [public org.springframework.http.ResponseEntity<org.springframework.security.oauth2.common.OAuth2AccessToken> org.springframework.security.oauth2.provider.endpoint.TokenEndpoint.postAccessToken(java.security.Principal,java.util.Map<java.lang.String, java.lang.String>) throws org.springframework.web.HttpRequestMethodNotSupportedException]
2017-11-17 07:40:04.850 DEBUG 9652 --- [http-nio-9191-exec-4] o.s.s.o.provider.endpoint.TokenEndpoint  : Clearing scope of incoming token request

我的结论是,即使我使用相同的 jdbctoken 数据库后端,我也需要在两个授权服务器之间进行共享会话管理,例如 spring session。

我找不到任何示例或任何人谈论这个,所以这是正确的,或者它应该在没有共享会话的情况下工作。

【问题讨论】:

    标签: spring-cloud spring-session spring-oauth2


    【解决方案1】:

    事实证明,是的,需要共享会话,就像 spring session 一样,我的第一次尝试没有成功,因为我在两台服务器之间进行了混合配置。

    在启用共享会话管理之后,一切正常

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2015-03-31
      • 2013-10-05
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2014-02-08
      • 1970-01-01
      • 2020-06-23
      相关资源
      最近更新 更多