V2EX = way to explore
V2EX 是一个关于分享和探索的地方
现在注册
已注册用户请  登录
fakeMaster
V2EX  ›  程序员

spring cloud 小白求教

  •  
  •   fakeMaster · 2023-01-08 12:10:42 +08:00 · 1293 次点击
    这是一个创建于 495 天前的主题,其中的信息可能已经有所发展或是发生改变。

    spring cloud oauth 使用的一个问题

    ClientDetailsServiceConfigurer 中设置了从数据库中设置 clients oauth_client_details 表中数据如下

    表中设置 resource_ids 有 user-server,shop-server

    每个服务有不同的 resourceId ,导致有一个问题是

    在新增新的服务(im-server)的时候,已经签发的 token 中没有新增服务的 resourceId ,导致这部分用户访问新的服务时提示错误

    {
      "error": "access_denied",
      "error_description": "Invalid token does not contain resource id (im-server)"
    }
    

    这个 resourceIds 是不是不应该这样设置?

    2 条回复    2023-01-08 23:30:13 +08:00
    leaves615
        1
    leaves615  
       2023-01-08 14:58:20 +08:00
    oauth 的 resourceId 是用于逻辑资源权限管理。 我认为不应该被用于微服务程序标记。
    如果一定要这样的话,新上线一个微服务就主动注销现有 token ,使之失效。强制重新获取。
    xuanbg
        2
    xuanbg  
       2023-01-08 23:30:13 +08:00
    自己写个 OAuth 服务吧,这个不像注册中心、网关、链路追踪这些,是第一层次的抽象。OAuth 涉及到了用户管理,是做不到完全抽象的。
    关于   ·   帮助文档   ·   博客   ·   API   ·   FAQ   ·   实用小工具   ·   2499 人在线   最高记录 6679   ·     Select Language
    创意工作者们的社区
    World is powered by solitude
    VERSION: 3.9.8.5 · 22ms · UTC 03:36 · PVG 11:36 · LAX 20:36 · JFK 23:36
    Developed with CodeLauncher
    ♥ Do have faith in what you're doing.