gpt4 book ai didi

Kubernetes Nginx-Ingress oauth_proxy 如何将信息/ token 传递给服务

转载 作者:行者123 更新时间:2023-12-02 11:39:11 26 4
gpt4 key购买 nike

我正在运行一个带有 Nginx-ingress 的 Kubernetes 集群,它面向几个 Web 应用程序。因为 Nginx 默认不支持 SSO/OIDC,所以我使用 oauth_proxy 进行身份验证。

一切正常,只有经过验证的用户才能访问网页。

是否可以从身份提供者向客户端传递或请求信息?

编辑

我已经将 oauth2_proxy ( https://github.com/pusher/oauth2_proxy ) 与 Azure AD 一起使用。问题是我需要来自 IP 的所有用户详细信息。

来自我的 oauth2_proxy 的日志:

$ kubectl logs oauth2-proxy-7ddc97f9d5-ckm29
[oauthproxy.go:846] Error loading cookied session: Cookie "_oauth2_proxy" not present
...
[requests.go:25] 200 GET https://graph.windows.net/me?api-version=1.6 {
"odata.metadata":"https://graph.windows.net/myorganization/$metadata#directoryObjects/@Element",
"odata.type":"Microsoft.DirectoryServices.User",
"objectType":"User",
... ,
"sipProxyAddress":"nico.schuck@example.com",
"streetAddress":"my stree",
"surname":"Schuck",
"telephoneNumber":55512345,
"usageLocation":"DE",
"userType":"Member"
}
165.xxx.xxx.214 - nico.schuck@example.com [2020/01/17 11:22:02] [AuthSuccess] Authenticated via OAuth2: Session{email:nico.schuck@example.com user: token:true id_token:true created:2020-01-17 11:22:02.28839851 +0000 UTC m=+181.592452463 expires:2020-01-17 12:22:02 +0000 UTC refresh_token:true}

最佳答案

考虑 oauth2_proxy,它适用于 SSO 的 nginx 入口。按照以下链接

https://github.com/bitly/oauth2_proxy

您应该在 Ingress Rule 中使用以下配置

metadata:
name: application
annotations:
nginx.ingress.kubernetes.io/auth-url: "https://$host/oauth2/auth"
nginx.ingress.kubernetes.io/auth-signin: "https://$host/oauth2/start?rd=$escaped_request_uri"

关于Kubernetes Nginx-Ingress oauth_proxy 如何将信息/ token 传递给服务,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/59819341/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com