spring-security-oauth2-autoconfigure-无效令牌:从版本2.1.5到版本2.3.1发生了什么变化
我已经成功地完成了以下教程,用于设置一些由oauth2保护的springboot微服务: 在本教程中,他们在ResourceServer和Auth Server的pom中硬编码了spring-security-oauth2-autoconfigure的依赖版本:spring-security-oauth2-autoconfigure-无效令牌:从版本2.1.5到版本2.3.1发生了什么变化,spring,spring-boot,oauth-2.0,spring-security-oauth2,Spring,Spring Boot,Oauth 2.0,Spring Security Oauth2,我已经成功地完成了以下教程,用于设置一些由oauth2保护的springboot微服务: 在本教程中,他们在ResourceServer和Auth Server的pom中硬编码了spring-security-oauth2-autoconfigure的依赖版本: <dependencyManagement> <dependency> <groupId>org.springframework.security.oauth.b
<dependencyManagement>
<dependency>
<groupId>org.springframework.security.oauth.boot</groupId>
<artifactId>spring-security-oauth2-autoconfigure</artifactId>
<version>2.1.5.RELEASE</version>
</dependency>
</dependencyManagement>
org.springframework.security.oauth.boot
spring-security-oauth2-autoconfigure
2.1.5.1发布
这很有效。但是,现在我对所有其他spring依赖项使用了版本2.3.1.RELEASE,我将spring-security-oauth2-autoconfigure依赖项从dependencyManagement移到了“普通”dependencies,并删除了其他版本行,因此它采用了父版本:
<parent>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-parent</artifactId>
<version>2.3.1.RELEASE</version>
<relativePath/> <!-- lookup parent from repository -->
</parent>
<dependencies>
<dependency>
<groupId>org.springframework.security.oauth.boot</groupId>
<artifactId>spring-security-oauth2-autoconfigure</artifactId>
</dependency>
</dependencies>
org.springframework.boot
spring启动程序父级
2.3.1.1发布
org.springframework.security.oauth.boot
spring-security-oauth2-autoconfigure
现在我已经做到了,我明白了
<InvalidTokenException>
<error>invalid_token</error>
<error_description>548d003e-c21e-445e-b184-d19fcc11ff4a</error_description>
</InvalidTokenException>
无效的\u令牌
548d003e-c21e-445e-b184-d19fcc11ff4a
当我尝试访问我的资源服务器时。但标记看起来完全相同。当我在auth服务器上通过将它传递给服务器来检查它时,它只有一个名为“active:true”的属性http://localhost:8001/oauth/check_token:
{
"active": true, <--- This is new
"exp": 1593397136,
"user_name": "admin",
"authorities": [
"POST_USER",
"GET_USER",
"ZUGRIFF_PRODUKT_KATALOG"
],
"client_id": "api-gateway",
"scope": [
"default"
]
}
{
“active”:正确,表示库spring-security-oauth2和spring-security-oauth2-autoconfigure正在维护中。因此最好不要使用它。另外,请检查
为了保护资源服务器的安全,您只需要org.springframework.boot:spring-boot-starter-oauth2-resource-server和web一起使用。上面说spring-security-oauth2和spring-security-oauth2-autoconfigure库正在维护中。因此,最好不要使用它。另外,请检查
为了保护资源服务器的安全,您只需要org.springframework.boot:spring-boot-starter-oauth2-resource-server和web一起使用。谢谢,但是如果我只使用该依赖项,那么它就无法解析导入fpr@EnableResourceServer注释:org.springframework.security.oauth2.config.Annotation.web.configuration.EnableResourceServer
@MarkusJackson您不需要该批注。请检查此要点谢谢,但如果我仅使用该依赖项,则无法解析导入fpr@EnableResourceServer批注:org.springframework.security.oauth2.config.annotation.web.configuration.EnableResourceServer
@MarkusJackson您不需要请检查一下这个要点