【发布时间】:2021-10-09 09:14:41
【问题描述】:
我已经在 Kubernetes 上部署了 pgadmin,我正在尝试按照 pgadmin docs 启用 oauth2
这是我传入的 oauth 配置:
AUTHENTICATION_SOURCES = ['oauth2', 'internal']
OAUTH2_CONFIG = [
{
# The name of the of the oauth provider, ex: github, google
'OAUTH2_NAME': 'gitlab',
# The display name, ex: Google
'OAUTH2_DISPLAY_NAME': 'Gitlab',
# Oauth client id
'OAUTH2_CLIENT_ID': 'my-client-id-here',
# Oauth secret
'OAUTH2_CLIENT_SECRET': 'my-client-secret-here',
# URL to generate a token,
# Ex: https://github.com/login/oauth/access_token
'OAUTH2_TOKEN_URL': 'https://gitlab.com/oauth/token',
# URL is used for authentication,
# Ex: https://github.com/login/oauth/authorize
'OAUTH2_AUTHORIZATION_URL': "https://gitlab.com/oauth/authorize",
# Oauth base url, ex: https://api.github.com/
'OAUTH2_API_BASE_URL': 'https://gitlab.com/api/v4/',
# Name of the Endpoint, ex: user
'OAUTH2_USERINFO_ENDPOINT': 'user',
# Font-awesome icon, ex: fa-github
'OAUTH2_ICON': 'fa-gitlab',
# UI button colour, ex: #0000ff
'OAUTH2_BUTTON_COLOR': '#E24329',
}
]
OAUTH2_AUTO_CREATE_USER = True
我已经在 Gitlab 上添加了应用程序。重定向 URI 是:
https://pgadmin.nonprod.example.io/oauth2/authorize
http://pgadmin.nonprod.example.io/oauth2/authorize
我为应用程序提供了以下范围:
- API
- openid
- 个人资料
- 电子邮件
我正在使用 pgadmin ingress 和我的本地 minikube 集群在本地对其进行测试。单击“使用 Gitlab 登录”按钮时,我不断收到以下错误:
{
success: 0,
errormsg: "403 Client Error: Forbidden for url: https://gitlab.com/api/v4/user",
info: "",
result: null,
data: null
}
我相信我拥有所有必要的 gitlab 权限并且无法弄清楚我做错了什么。
【问题讨论】:
标签: kubernetes oauth-2.0 gitlab pgadmin