cod*_*123 1 java spring oauth spring-security
有两个服务。我正在使用 Netflix 堆栈 [Eureka/zuul]。
当我运行一个用户服务实例时,一切正常,但是当我在另一台服务器上运行另一个实例时,我遇到了下面提到的错误并且请求 [login oauth] 失败。
我想扩展使用 spring oauth 的 USER-SERVICE。
处理错误:InvalidGrantException,无效授权码:Q1j7Hs 06:24:17.253 [http-nio-8081-exec-2] INFO ossopeTokenEndpoint - 处理错误:InvalidGrantException,无效授权码:w9uvl1
任何线索或建议将不胜感激。
配置AuthorizationServerConfiguration使用 JdbcAuthorizationCodeServices服务在所有认证节点之间通过数据库存储和共享授权码。
@Configuration
@EnableAuthorizationServer
protected static class AuthorizationServerConfiguration extends AuthorizationServerConfigurerAdapter implements EnvironmentAware {
@Inject
private DataSource dataSource;
@Bean
public TokenStore tokenStore() {
return new JdbcTokenStore(dataSource);
}
// JdbcAuthorizationCodeServices stores authentication codes in a database.
@Bean
public JdbcAuthorizationCodeServices jdbcAuthorizationCodeServices() {
return new JdbcAuthorizationCodeServices(dataSource);
}
@Inject
@Qualifier("authenticationManagerBean")
private AuthenticationManager authenticationManager;
@Override
public void configure(AuthorizationServerEndpointsConfigurer endpoints) throws Exception {
endpoints
.tokenStore(tokenStore())
.reuseRefreshTokens(false)
.authenticationManager(authenticationManager)
.authorizationCodeServices(jdbcAuthorizationCodeServices());
}
}
Run Code Online (Sandbox Code Playgroud)
并创建oauth_code表:
CREATE TABLE oauth_code (
code VARCHAR(256), authentication LONGVARBINARY
);
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
1964 次 |
| 最近记录: |