问题标签 [oauth2-proxy]

For questions regarding programming in ECMAScript (JavaScript/JS) and its various dialects/implementations (excluding ActionScript). Note JavaScript is NOT the same as Java! Please include all relevant tags on your question; e.g., [node.js], [jquery], [json], [reactjs], [angular], [ember.js], [vue.js], [typescript], [svelte], etc.

0 投票
1 回答
218 浏览

azure - 微软!德语!Azure Cloud - 让 oauth2-proxy 工作

我正在尝试设置 oauth2-proxy 以针对微软的德国天蓝色云进行身份验证。这是一段旅程,但我已经能够进行 oauth 握手。但是,尝试通过图形 API 接收用户邮件和名称时出现错误。

我像这样在 docker 中运行代理:

现在它偶然发现了个人资料网址(用于检索用户登录的身份)

日志输出是这样的:

我真的很感激关于我在这里做错了什么的建议?到目前为止,文档对我并没有真正的帮助。似乎德国天蓝色云中的情况略有不同,但文档非常薄。azure 文档仅描述了所有 url 都不同的美国云(不幸的是,这不是很合乎逻辑的意义),这一事实使事情变得更加困难......

最好的,马蒂亚斯

0 投票
0 回答
365 浏览

kubernetes-helm - 如何将 authenticatedEmailIds 传递给 helm chart stable/oauth2_proxy?

我正在使用命令安装以下掌舵图https://github.com/helm/charts/tree/master/stable/oauth2-proxy

所有 k8 资源都已正确创建,并且 oauth2_proxy 正在保护我在此代理后面运行的服务。但它允许所有 github 用户(因为 oauth 提供者是 github)而不是只允许访问 abc@gmail.com。为什么会这样?

头盔版

Kubectl 版本

kubectl describe cm authproxy-oauth2-proxy-accesslist -n ingress 给了我

kubectl describe deployment authproxy-oauth2-proxy -n ingress 给了我:

我应该如何向这个 helm 图表提供参数,以便它只允许访问在 authenticateEmailList 中提到其电子邮件 ID 的用户?

0 投票
4 回答
5042 浏览

azure - How can I debug oauth2_proxy when connecting to Azure B2C?

I'm new to Kubernetes, and I've been learning about Ingress. I'm quite impressed by the idea of handling TLS certificates and authentication at the point of Ingress. I've added a simple static file server, and added cert-manager, so I basically have a HTTPS static website.

I read that NGINX Ingress Controller can be used with oauth2 proxy to handle authentication at the ingress. The problem is that I can't get this working at all. I can confirm that my oauth2-proxy Deployment Service and Deployment are present and correct - in the Pod's log, I can see the requests coming through from NGINX, but I can't see what uri it is actually calling at Azure B2C. Whenever I try and access my service I get a 500 Internal error - if I put my /oath2/auth address in the browser, I get "The scope 'openid' specified in the request is not supported.". However if I Test run the user Flow in Azure, the test URL also specifies "openid" and it functions as expected.

I think that I could work through this if I could find out how to monitor what oauth2-proxy requests from Azure (i.e. work out where my config is wrong by observing it's uri) - otherwise, maybe somebody that has done this can tell me where I went wrong in the config.

My config is as follows:

In my static site ingress I have the following added to metadata.annotations:

I'm not 100% sure whether these annotations should always be set as such, or whether I should have varies these for B2C/OIDC, but they seem to go off to the proxy, it's just what the proxy does next that fails.

Note that the log does indicate that oauth2-proxy connected to B2C, indeed if the issuer uri changes, then it goes into a crash fallback loop.

There seem to be anumber of articles about how to set this up, so I'm sure it's possible, but I got a little lost. If somebody could help with the setup or ideas for debugging, that would be wonderful.

Thanks.


Now I'm able to reliably get a ?state= and code= to display in the browser window on the /oauth2/callback page, but the page reports Internal Error. oauth2_proxy is logging when it should now, and the log says:

[2020/06/03 21:18:07] [oauthproxy.go:803] Error redeeming code during OAuth2 callback: token exchange: oauth2: server response missing access_token

My Azure B2C Audit log howwever says that it is issuing id_tokens.

When I look at the source code to oauth2_proxy, it looks as though the problem occurs during oauth2.config.Exchange() - which is in the goloang library - I don't know what that does, but I don't think that it works properly with Azure B2c. Does anybody have an idea how I can progress from here?

Thanks.

Mark

0 投票
1 回答
4542 浏览

oauth-2.0 - 带有 Keycloak 的 Oauth2_proxy:使用 /userinfo API 获取“invalid_token”

我第一次尝试使用 Keycloak,并使用 Keycoak 作为 oauth2_proxy 的提供者(https://github.com/oauth2-proxy/oauth2-proxy/blob/v5.1.1/providers/keycloak.go)通过 LDAP 实现用户身份验证. 我已按照 Keycloak 中的所有步骤创建领域、创建客户端、客户端 ID、客户端密码等。Keycloak API“/token”也在传递。但是,一旦我在 keycloak 登录屏幕中传递用户名/密码,我会在 oauth2_proxy 中收到以下错误:

在启动 oauth2_proxy docker 容器时,我还传递了以下参数:

有人可以帮忙解决可能丢失或出错的问题吗?任何线索或提示都会非常有帮助。

0 投票
1 回答
1874 浏览

kubernetes - oauth2 代理边车的目的是什么?

您能否解释一下为什么可以使用oauth2-proxy作为 sidecar?例如,k8s 中的每个 pod 都有这个 sidecar 的架构,它代理 Keycloack。

0 投票
1 回答
2274 浏览

quay.io - quay.io OAuth2 代理:将承载令牌设置为授权标头

我想做的事

调用由 oauth2 代理代理的 URL。如果没有可用的身份验证,oauth2 代理应该执行授权代码流。如果已经有可用的身份验证,则应将访问令牌设置为转发到上游的请求中的授权标头。

我试过的

根据我希望的文档--pass-authorization-header,在设置请求的令牌时,应将其添加到授权标头中。

我还尝试了--pass-access-token应该设置一个 X-Forwarded-Access-Token 标头。在我的服务中我也看不到这个标题。

有人可以向我解释我做错了什么吗?

0 投票
1 回答
2078 浏览

kubernetes - Oauth2-Proxy 不传递 X-Auth-Request-Groups 标头

我正在使用 Azure B2C 对我的用户进行身份验证。对于身份验证部分,我在 kubernetes 集群中运行了 oauth2-proxy。Oauth2-Proxy 在 ingress-nginx 后面运行,它传递了大部分必需的标头,但我没有在 oauth2-proxy 后面的上游服务中获得 X-Auth-Request-Groups 标头。

这是我从 B2C 获得的令牌:

以下是成功认证后我在上游服务中获得的标头:

所有 X-Auth-Request-* 标头都将出现,但不是带有组的标头。我正在使用 docker image quay.io/oauth2-proxy/oauth2-proxy:v6.1.1我在配置中看到https://oauth2-proxy.github.io/oauth2-proxy/configuration选项“--oidc-groups -claim”,但是当我尝试使用它时,容器将无法启动,因为此选项在此版本中不可用。

有什么我想念的想法吗?

0 投票
1 回答
3173 浏览

kubernetes - 使用 nginx-ingress 和 keycloak 在 Kubernetes 中进行身份验证的正确设计是什么

目标

我想使用 keycloak 作为我的 minikube 集群的 oauth/oidc 提供程序。

问题

我对可用的文档感到困惑。

根据此文档, ngnix-ingress 可以使用注释处理外部身份验证

  • nginx.ingress.kubernetes.io/auth-method
  • nginx.ingress.kubernetes.io/auth-signin

但是从文档中不清楚这里使用了哪种身份验证。是 OAUTH/BASIC/SAML 吗???

例如,我没有找到任何变量来为入口提供 oauth CLIENTID。

其他发现

我还发现了这个项目https://github.com/oauth2-proxy/oauth2-proxy 这似乎是我需要的并提供以下设计

用户 -> ngnix-ingress -> oauth2-proxy -> keycloak

问题:

  1. 我是否必须使用 oauth2-proxy 来实现 keycloak oauth?
  2. 我说 ngnix-ingress 没有直接连接到 keycloak 的功能是对的吗?
  3. 是否有关于 nginx.ingress.kubernetes.io/auth-method 和 nginx.ingress.kubernetes.io/auth-signin 到底在做什么的明确文档?
  4. 是否有任何正确的方法/文档来构建用户 -> ngnix-ingress -> oauth2-proxy -> keycloak集成?
0 投票
1 回答
2423 浏览

nginx - Keycloak、oauth2-proxy 和 nginx.ingress.kubernetes

我在通过 oauth2-proxy/keycloak 验证 kubernetes webapp 时遇到问题。你不知道怎么了

  • Webapp (test-app.domain.com)
  • oauth2-proxy (oauth2-proxy.domain.com)
  • 密钥斗篷(keycloak-test.domain.com)

这三个应用程序分别运行。

认证过程说明:

打开test.domain.com后重定向到https://keycloak-test.domain.com/auth/realms/local/protocol/openid-connect/auth?approval_prompt=force&client_id=k8s2&redirect_uri=https%3A%2F%2Foauth2- proxy.domain.com%2Foauth2%2Fcallback&response_type=code&scope=openid+profile+email+users&state=7a6504626c89d85dad9337f57072d7e4%3Ahttps%3A%2F%2Ftest-app%2F

Keycloak 登录页面显示正确,但用户登录后我得到: 500 Internal Server Error with URL https://oauth2-proxy.domain.com/oauth2/callback?state=753caa3a281921a02b97d3efeabe7adf%3Ahttps%3A%2F%2Ftest-app.domain .com%2F&session_state=f5d45a13-5383-4a79-aa7a-56bbaa16056f&code=5344ae72-a9ee-448f-95ef-45e413f69f4b.f5d45a13-5383-4a79-aa7a-56bbaa16056f.78732ee5-af48-c517-6

来自 oauth2-proxy 的日志

测试应用入口

oauth2-proxy 配置和入口

0 投票
1 回答
84 浏览

openid-connect - OKTA:在 Okta 中验证 OIDC 配置的 clientId 和 clientSecret

我想在我的应用程序中测试客户为 OIDC 配置提供的 Okta clientId 和 clientSecret。我认为唯一有用的 API 是令牌 API ({issuerURI}/oauth2/default/v1/token),但此 API 要求管理员为授权服务器创建一个自定义范围,以作为“范围”参数的值以及“grant_type:client_credentials”传递。这会影响用户体验。现有的默认范围,例如“openid、email、profile”等不适用于“client_credentials”grant_type。有没有办法验证 clientId 和 clientSecret?