【发布时间】:2021-07-26 12:47:22
【问题描述】:
我正在尝试将指标推送到经过基本身份验证的推送网关。但我遇到了 401 - 未经授权
所以我安装了一个本地推送网关并配置了基本身份验证:
密码按照此处所述进行加密:https://github.com/prometheus/exporter-toolkit/blob/master/docs/web-configuration.md#about-bcrypt
basic_auth_users:
pushgateway: $2y$10$d6t8zGfPMZBLFLpoClFcReK6z4gxkDr2H8jnEfOaUpjpLX4.tbyTS%
在我的代码中,我指定用户名和密码如下:
this.pushGateway.setConnectionFactory(new BasicAuthHttpConnectionFactory("pushgateway","<password>"));
上面的密码是经过加密并放入推送网关配置的密码。
这里的文档 (https://github.com/prometheus/client_java#with-basic-auth) 没有提到任何关于加密密码的内容,密码是以明文形式提供的。
有人可以指出我缺少什么吗?
【问题讨论】:
标签: basic-authentication bcrypt prometheus-pushgateway