有人知道SpringBoot和Spring Oauth2中的版本管理如何工作吗? 当我更改SpringBoot和Spring Oauth2的版本时,我从获得有效的访问权和刷新令牌变为“未授权”错误。我正在使用spring-boot-starter-parent。 我运行了一些测试及其Spring Boot版本。当我将版本从1. 。更改为2. 。时,“ / oauth / token”将不再受到攻击。 这是Autherization服务器的配置:
@Configuration
@EnableAuthorizationServer
public class AuthorizationServerConfig extends
AuthorizationServerConfigurerAdapter {
@Override
public void configure(ClientDetailsServiceConfigurer configurer) throws
Exception {
configurer
.inMemory()
.withClient(CLIENT_ID)
//.secret("secret")
.authorizedGrantTypes(GRANT_TYPE_PASSWORD, REFRESH_TOKEN)
.redirectUris("http://localhost:8080/")
.scopes(SCOPE_READ)
.accessTokenValiditySeconds(ACCESS_TOKEN_VALIDITY_SECONDS).
refreshTokenValiditySeconds(REFRESH_TOKEN_VALIDITY_SECONDS);
}
...
}
答案 0 :(得分:0)
从SpringBoot 1转到2时,
如果您在Spring Boot 1中使用客户端机密,则不需要传递哈希值,但是在Spring Boot 2中,您需要这样做:
inMemory()
.withClient(CLIENT_ID)
.secret(passwordEncoder.encode("secret"))