【问题标题】:Jhipster Registry Release 3.2.4 - can't change admin passwordJhipster Registry Release 3.2.4 - 无法更改管理员密码
【发布时间】:2018-04-20 08:08:40
【问题描述】:

我在 Windows 环境(开发)上使用registry release 3.2.4

我想更改默认管理员密码。

根据documentation,我只需要在我的application-*.yml 文件上定义security.user.password

所以我的central-config/application-dev.yml变成了

jhipster:
    security:
        authentication:
            jwt:
                secret: my-secret-token-to-change-in-production
    registry:
        password: admin123

我启动我的注册表java -jar jhipster-registry/jhipster-registry-3.2.4.war --spring.profiles.active=swagger,dev,native(这里设置参数--spring.profiles.active只是为了确保我的配置文件正确加载)。

我尝试使用管理员用户连接http://127.0.0.1:8761/#/...但我的新密码不起作用(只是默认的“管理员”密码仍然有效)。

当注册表启动时,我收到了这些警告

WARN 1152 --- [           main] c.n.c.sources.URLConfigurationSource     : No URLs will be polled as dynamic configuration sources.
WARN 1152 --- [           main] o.s.j.e.a.AnnotationMBeanExporter        : Bean with key 'zuulEndpoint' has been registered as an MBean but has no exposed attributes or operations

当我尝试连接时,这个警告

WARN 1152 --- [  XNIO-2 task-1] o.s.c.n.zuul.web.ZuulHandlerMapping      : No routes found from RouteLocator

当我查看应用程序上的配置加载时,它看起来还不错 My cloud configuration

我尝试在启动注册表时添加-e JHIPSTER_SECURITY_AUTHENTICATION_JWT_SECRET=my-secret-token-to-change-in-production-e SECURITY_USER_PASSWORD=admin123,但仍然不起作用。

有什么想法吗?

谢谢

【问题讨论】:

    标签: jhipster jhipster-registry


    【解决方案1】:

    密码必须设置在两个地方;在注册中心的 application.yml 和注册中心客户端(服务和网关)中它们自己的 bootstrap.yml 中,因为只有在应用能够连接到注册中心后才能读取 central-config 中的属性。

    您还可以在环境变量 SECURITY_USER_PASSWORD 中设置它,并在这些文件中使用占位符以避免在您的 git 存储库中暴露它,同时在一个地方进行管理。

    【讨论】:

    • 感谢您的回复,但我仍有问题。我有我的central-config\application.ymlcentral-config\boostrap.yml 这个配置。 jhipster: registry: password: admin123 但我仍然可以在127.0.0.1:8761 上与管理员/管理员联系。当我查看127.0.0.1:8761/#/config 时,我看到了jhipster.registry.password: admin123
    【解决方案2】:

    我只需要处理 JHipster Registry 4.1.1 的相同问题。由于文档和命令行选项声明使用 spring.security.user.password 属性,我已经更新了我的 application.yml 如下

    jhipster:
        security:
            authentication:
                jwt:
                    secret: my-secret-token-to-change-in-production
    spring:
        security:
            user:
                password: admin1234
    

    它对我来说按预期工作。

    【讨论】:

      猜你喜欢
      • 2019-11-26
      • 1970-01-01
      • 1970-01-01
      • 2020-06-07
      • 2021-10-18
      • 1970-01-01
      • 1970-01-01
      • 2018-04-03
      • 1970-01-01
      相关资源
      最近更新 更多