在 k8s Ingress 上重命名 vouch-proxy http 标头
我正在尝试将声明添加到 http 标头中。我有一个 k8s 入口
annotations:
nginx.ingress.kubernetes.io/auth-signin: "https://vouch.example.com/login?url=$scheme://$http_host$request_uri&vouch-failcount=$auth_resp_failcount&X-Vouch-Token=$auth_resp_jwt&error=$auth_resp_err"
nginx.ingress.kubernetes.io/auth-url: https://vouch.example.com/validate
nginx.ingress.kubernetes.io/auth-response-headers: 'X-Vouch-User, X-Vouch-Idp-Claims-Name'
nginx.ingress.kubernetes.io/auth-snippet: |
auth_request_set $auth_resp_jwt $upstream_http_x_vouch_jwt;
auth_request_set $auth_resp_err $upstream_http_x_vouch_err;
auth_request_set $auth_resp_failcount $upstream_http_x_vouch_failcount;
和一个 vouch 配置:
vouch:
headers:
idtoken: X-Vouch-IdP-IdToken
claims:
- name
一切正常,我可以很好地进行身份验证,并且我可以在 x-vouch-user
和 x-vouch 下看到我的电子邮件和姓名-idp-claims-name 分别是 http 标头。但是,我想映射标题以使用更合适的东西。
我已经尝试过
annotations:
nginx.ingress.kubernetes.io/configuration-snippet: |
proxy_set_header Remote-User $http_x_vouch_idp_claims_name;
,但似乎不起作用。在我的 proxy_set_header
中使用的正确变量名称是什么?
i'm trying to add a claim into the http header. i have an k8s ingress with
annotations:
nginx.ingress.kubernetes.io/auth-signin: "https://vouch.example.com/login?url=$scheme://$http_host$request_uri&vouch-failcount=$auth_resp_failcount&X-Vouch-Token=$auth_resp_jwt&error=$auth_resp_err"
nginx.ingress.kubernetes.io/auth-url: https://vouch.example.com/validate
nginx.ingress.kubernetes.io/auth-response-headers: 'X-Vouch-User, X-Vouch-Idp-Claims-Name'
nginx.ingress.kubernetes.io/auth-snippet: |
auth_request_set $auth_resp_jwt $upstream_http_x_vouch_jwt;
auth_request_set $auth_resp_err $upstream_http_x_vouch_err;
auth_request_set $auth_resp_failcount $upstream_http_x_vouch_failcount;
and a vouch config with:
vouch:
headers:
idtoken: X-Vouch-IdP-IdToken
claims:
- name
everything works, and i can authenticate fine and i can see both my email and name under the x-vouch-user
and x-vouch-idp-claims-name
http headers respectively. However, i would like to map the headers to use something more appropriate.
I've tried
annotations:
nginx.ingress.kubernetes.io/configuration-snippet: |
proxy_set_header Remote-User $http_x_vouch_idp_claims_name;
but it doesn't seem to work. what are the correct variable name(s) to use in my proxy_set_header
?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
我需要将原始 OIDC ID 令牌代理到下游服务。我能够通过此设置解决问题...
我设置 Vouch 代理配置以添加
X-Vouch-IdP-IdToken
标头:然后在 ingress-nginx 注释中,我能够重命名通过在
configuration-snippet
< /a> 注释如下:I needed to proxy the original OIDC ID Token to the downstream service. I was able to solve the problem with this setup...
I set the Vouch Proxy config to add the
X-Vouch-IdP-IdToken
header:Then in the ingress-nginx annotations, I was able rename the
X-Vouch-IdP-IdToken
toAuthorization
by adding theauth_request_header
setting in theconfiguration-snippet
annotation to the following: