从具有身份验证服务器作为eureka客户端的资源服务器访问身份验证服务器时出错

嗨,我在springboot中实现了oauth2服务。验证服务器和资源服务器已通过eureka客户端启用,它们也已成功注册到eureka服务器。

这样配置资源服务器中auth-server的URI
cv2.waitKey(60000)

上面的URI中的import time prev_time = time.time() count = 0 delay = 1 # in seconds while True: if time.time()-prev_time > delay: count += 1 print(count) prev_time = time.time() 现在是authserver的应用程序名称。我希望资源服务器从eureka服务器解析出网址后,应该使用security: oauth2: resource: token-info-uri: http://auth-server/oauth/check_token 与auth服务器联系。但是通过这种设置,我得到了一个错误auth-server

我对此进行了修改

token-info-uri

但我得到回应

nested exception is java.net.UnknownHostException: auth-server

调试时,我有此日志

security:
  oauth2:
    resource:
      prefer-token-info: false
      service-id: auth-server
      token-info-uri: http://${security.oauth2.resource.service-id}/oauth/check_token
      loadBalanced: true

我看到的基本上是URI

q247877488 回答:从具有身份验证服务器作为eureka客户端的资源服务器访问身份验证服务器时出错

您不能仅在属性文件中使用名称。应该是

security:
 oauth2:
  resource:
   service-id: {Service ID as at eureka server registered}
   token-info-uri: http://${security.oauth2.resource.service-id}/oauth/check_token
   loadBalanced=true
   prefer-token-info=false

P.S我刚刚用手打字。确保保持适当的空间

,

在Darshu提供的错误日志中,有以下消息:“ asset-mgmt-v1.1_1 | 2019-11-16 17:52:08.120 DEBUG 1 --- [nio-6001-exec-2] osbasorUserInfoTokenServices:userinfo返回错误:无法获取用户详细信息。”

必须将preferred-token-info设置为true才能确定token-info-uri优先于user-info-uri。

security:
      oauth2:
           resource:
                  prefer-token-info: true

https://docs.spring.io/spring-security-oauth2-boot/docs/2.0.0.RC2/reference/htmlsingle/#boot-features-security-oauth2-resource-server

中查看更多
本文链接:https://www.f2er.com/3094933.html

大家都在问