简体   繁体   English

有没有办法在jhipster中使用单独的微服务登录?

[英]Is there a way to have a seperate microservice for login in jhipster?

我注意到,当我生成一个微服务网关时,身份验证服务是该网关的一部分,我可以在自己的微服务中进行身份验证,而不是将其与前端代码一起生成吗?

You can generate a jhipster gateway without the frontend code by running 您可以通过运行生成没有前端代码的jhipster网关

jhipster --skip-client

For this case the jhipster documentation states: 在这种情况下, jhipster文档说明:

This should only work well for monoliths, as this doesn't make much sense for microservices (which have no front-end anyway) and gateways (which are basically a monolith with the Zuul gateway service enabled). 这应该只适用于整体块,因为这对于微服务(无论如何没有前端)和网关(基本上是启用了Zuul网关服务的整体块)没有多大意义。

However, if you stick to JWT and you generate the app using the jdl you can also set skipUserManagement to true. 但是,如果您坚持JWT并使用jdl生成应用程序,则还可以将skipUserManagement设置为true。

application {
  config {
    applicationType gateway,
    serviceDiscoveryType consul,
    authenticationType jwt,
    skipUserManagement false
    skipClient true
  }
}

Using this configuration all the User and Authentication related classes will not be generated. 使用此配置,将不会生成所有与用户和身份验证相关的类。 This is basically a gateway that will only route the requests to the microservices, without handling any authentication at all. 这基本上是一个网关,它只会将请求路由到微服务,而根本不处理任何身份验证。

Interesting fact (if I'm not mistaken): if you disable the service discovery from the above configuration you will have exactly the same code as you would have in a microservice application. 有趣的事实(如果我没有记错的话):如果你从上面的配置中禁用服务发现,你将拥有与微服务应用程序中完全相同的代码。

Some related links: 一些相关链接:

Not directly with JWT, you have to code it manually. 不直接使用JWT,您必须手动编码。 Otherwise you could choose another auth type option that uses external service like keycloak, uaa, or okta. 否则,您可以选择另一个使用外部服务的auth类型选项,如keycloak,uaa或okta。

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

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