简体   繁体   English

JHipster rest api 只允许微服务

[英]JHipster rest api permit only microservice

I have a JHipster Microservice application in which there is a dependency between 2 microservices, msA and msB.我有一个 JHipster 微服务应用程序,其中 2 个微服务 msA 和 msB 之间存在依赖关系。

  1. A user makes a rest call to msA用户对 msA 进行休息调用
  2. msA processes the request and makes an AuthorizedFeignClient call to a rest endpoint on msB to perform some other logic with the user. msA 处理请求并对 msB 上的其余端点进行 AuthorizedFeignClient 调用,以与用户执行一些其他逻辑。

My problem is, the logic performed in msB is only internal, needs to know the user and should not be exposed to the outside user.我的问题是,在 msB 中执行的逻辑只是内部的,需要了解用户,不应暴露给外部用户。 How can I restrict the rest endpoint on msB so that only another microservice can make requests to it and not a public user?如何限制 msB 上的其余端点,以便只有另一个微服务可以向它发出请求,而不是公共用户?

  • require some specific role for this endpoint and assign this role to an internal user that msA will use.需要此端点的某些特定角色,并将此角色分配给 msA 将使用的内部用户。 Both oauth2 and uaa auth types in JHipster define an internal client id and secret that you can customize for this use case. JHipster 中的 oauth2 和 uaa auth 类型都定义了一个internal客户端 ID 和机密,您可以为此用例自定义。
  • do not expose this endpoint as a route of your API gateway through Zuul routes configuration in gateway's application.yml as inter-service communication does not go through gateway不要通过网关的application.yml Zuul 路由配置将此端点公开为 API 网关的路由,因为服务间通信不通过网关

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM