如何使用 JHipster Registry [Docker] 修复无效的 JWT? [英] How to fix Invalid JWT with JHipster Registry [Docker]?
问题描述
我想用 JHipster 构建一个微服务软件.我在 Docker 中运行 jhipster-registry:v3.2.4,我还有一个微服务应用程序(使用生成器 5.0.1 创建),但我没有生成网关应用程序.
I want to build a microservices software with JHipster. I'm running jhipster-registry:v3.2.4 into Docker, i also have a microservice application (create with generator 5.0.1) but i do no generate a gateway application.
我在 docker-compose.yml 中设置了配置文件:dev 和 native
I set the profiles in docker-compose.yml with: dev and native
我在 Docker Compose 文件中设置了 JWT Secret.
I setted the JWT Secret in Docker Compose file.
我将配置文件添加到:central-config 文件夹中
I added configurations files into : central-config folder
我将我的微服务的 jwt 设置到所有可能的 *.yml 文件中
I setted the jwt for my microservice into all possible *.yml files
但是在注册表 UI 上,当我尝试访问微服务日志或指标时,我得到了一个异常:无效的 JWT 签名.
but on the registry UI, when i'm trying to access microservices logs or metrics, i got an Exception : Invalid JWT Signature.
推荐答案
当你使用原生配置文件时,你可以通过设置来使用配置文件SPRING_CLOUD_CONFIG_SERVER_NATIVE_SEARCH_LOCATIONS=file:./config/
在您的 compose .yml 和 config 文件夹中,添加一个 application.yml 文件
As you use the native profile, you can use a config file by setting
SPRING_CLOUD_CONFIG_SERVER_NATIVE_SEARCH_LOCATIONS=file:./config/
in your compose .yml and in a config folder, you add an application.yml file with
jhipster:
security:
authentication:
jwt:
secret: your secret
这篇关于如何使用 JHipster Registry [Docker] 修复无效的 JWT?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!